DATEFORMAT problem

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

DATEFORMAT problem

Post by malcolmboston »

hi guys

i came across a problem yesterday that much have arisen a while back
basically i hold the dates in a MySQL table using the format
2004-12-12 14:15:18
now i changed it using the dateformat feature however now i am unable to use my sort functions that i developed for it (sort by last logged in, sort by register date etc)

was wondering if theres anyway around this as i cannot see the reason why it is doing this as it is still stored in MySQL as the original format

any ideas?
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post by andre_c »

how did you change it?
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

im not at my machine atm but something like

Code: Select all

$query = "SELECT *, DATE_FORMAT(last_login, '%H:%i - %d/%m/%y ') AS last_login FROM members ORDER BY access_level ASC" or die(mysql_error());
should work

hope that helps

anyone got any idea on my problem?
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

no1 ever experienced this? :(
Post Reply