This is probably something easy to accomplish. I have some dates in my MySQL database, (and I am using PHP). Some are stored as such 2010-08-25 11:00:00, while others are stored as 2010-08-25T08:00:00
My question is: I am selecting the dates from the database, and then using ORDER BY start_date
However, I have noticed that when the date string includes a “T”, it is pushing it down in the order. For example, my dates being returned are:
2010-08-25 11:00:00
2010-08-25 14:15:00
2010-08-25T08:00:00
2010-08-25T14:30:00
2010-08-25T15:00:00
As you can see, events at 8am are showing up after events at 2:15pm.
Any ideas on how I can re-arrange it so that the 8am events are moved toward the top?
Thanks.
You could always just get the list of dates into PHP, use string functions to convert the ‘T’ to a space, and then sort the list.
Definitely not a good solution though. It would be better to fix the data in your database, if possible.