you can store them in DATETIME and change their format in the select...
SELECT DATE_FORMAT(datetime_col, '%d.%m.%Y') AS new_datetime_col FROM table ORDER BY datetime_col DESC
just replace %d.%m.%Y with your format![]()
Hi,
I'm a bit of a newbie to PHP and MySQL, and I have trouble working with dates (in any programming language). Could someone please advise me as to how I can sort dates, if they are stored as a character string? If that's not possible, is it possible to store dates as DATETIME, and then change the format after the values are brought out of the database? Thanks for your help.![]()
a.aimoo.com - Get your forum reviewed here!
desilva.biz - Great webmaster tips and tricks!
webmaster-talk.com - Discussion forum for all webmasters
you can store them in DATETIME and change their format in the select...
SELECT DATE_FORMAT(datetime_col, '%d.%m.%Y') AS new_datetime_col FROM table ORDER BY datetime_col DESC
just replace %d.%m.%Y with your format![]()
Last edited by hohoho; March 1st, 2003 at 07:39.
There are 3 kinds of people: the ones who can count and the others who cannot
Thanks! I will try that out now.![]()
a.aimoo.com - Get your forum reviewed here!
desilva.biz - Great webmaster tips and tricks!
webmaster-talk.com - Discussion forum for all webmasters
Bookmarks