waynew Posted July 9, 2008 Share Posted July 9, 2008 Okay, I've got a number of rows in a table. They all have a column with a date in it. 2007/11/23 etc. How do can I take this data out and make calculations on it with php. When I say calculations I mean determining the month etc... I've googled around but I keep getting the wrong articles. Quote Link to comment https://forums.phpfreaks.com/topic/113932-solved-dates-from-mysql/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 9, 2008 Share Posted July 9, 2008 If these dates are actually yyyy-mm-dd in a mysql DATE type column, you can do things like find the month (extract it or compare it) directly in the query. Mysql has about 20-30 date and time functions that let you do almost anything you need with a DATE, DATETIME, or TIME field. Multiple lines of slow php code is not necessary in most cases. Quote Link to comment https://forums.phpfreaks.com/topic/113932-solved-dates-from-mysql/#findComment-585481 Share on other sites More sharing options...
waynew Posted July 9, 2008 Author Share Posted July 9, 2008 Great. Thanks. I had just found the date functions for mySQL. Thanks anyway. Quote Link to comment https://forums.phpfreaks.com/topic/113932-solved-dates-from-mysql/#findComment-585495 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.