I have a bunch of records in a MySQL table, each with a date attribute (m.d.Y), and a time attribute stored as hr:min:sec. I want to sort them chronologically based on both the date and the time. How would I do that with PHP/MySQL?
Edit: If you think there’s a more efficient way at storing my date and time in the database, please let me know.
Yes, make a field of
datetimeortimestampin your table, create an index by this field and sort by it.Queries: