Best practices for storing & selecting time/date with php & mysql?
- by Adam
I often find myself storing data in a mysql database, and then wanting to display all sorts of stats about my data, specifically stuff like 'how many rows do I have for this date, or that date'.
Does anyone know of (or could write) a good tutorial on this subject?
Ideally a good tutorial would overview:
Best practices when storing the data (i.e. what formats to use, how to use them servertime vs. generated time, etc.)
Best practices when selecting data from the database with php (i.e. how to sort rows by date, how to retrieve only rows from a certain date, or a certain hour, etc)..
Timezones and other issues that might come up.
Thanks in advance.