boylesg Posted January 30, 2014 Share Posted January 30, 2014 (edited) If you use this type for one of the columns in a table, what exactly do you get back for that column when you do a query. Is it a string of the format yyyy/mm/dd....... or does the column data get mapped into some sort of data structure that you then interrogate in php code? Also what sort of collation, if any, should you have afor a date column? ascii_bin? Edited January 30, 2014 by Greg Boyles Link to comment Share on other sites More sharing options...
Ingolme Posted January 30, 2014 Share Posted January 30, 2014 SQL queries always return strings, Even number data types. PHP has to cast them itself. With numbers you usually don't have to worry about the casting, but with dates you have to parse the string. I think the strtotime() function will work fine. Personally, I store dates as a UNIX timestamp in an INT field in MySQL. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now