Page 1 of 1
Changing Date format
Posted: Tue Dec 02, 2003 12:35 pm
by Draco_03
Hey i use phpmyadmin
i want my date format in UK (dd/mm/yyyy) instead of US default wich is (yyyy/mm/dd)
so i tried this
Code: Select all
UPDATE `clients` SET `date` = 'uk' WHERE `date` = 'timeformat' AND `date` = 'us' LIMIT 1
but it didn t do anything..
i run it in the phpmyadmin query box.. there s no error
i have a table named clients and on field name date ......
mhh nyways can anyone tell me why or how can i change the date format
thank you
Posted: Tue Dec 02, 2003 1:19 pm
by xisle
set the field type to a varchar and "SET date=DATE_FORMAT(NOW(),'%d/%m/%Y')"
or use PHP to format your date and insert that "SET date='{$newdate}'"
Posted: Tue Dec 02, 2003 1:33 pm
by Draco_03
i had no error it worked well.. but i wonder.. i entered a date like today 02-12-2003 but the table don t take it as a date it s varchar so if someone in my form enter some crazy stuff let s say 99-99-9999.... will it work or it will know it s not possible.. ?
thx a lot

Posted: Wed Dec 03, 2003 7:05 am
by twigletmac
Why not store the date in a DATE field? It will make it a lot easier to manipulate, VARCHAR's very limited when it comes to dates and times. Then you just use DATE_FORMAT() to retrieve the date in whatever format you want.
Mac
Posted: Wed Dec 03, 2003 8:22 am
by Draco_03
Okay .. i just wanted to know if i could save myself to dat_format each time i want to display it
but thx that what i ll do i ll put it in a date field and i ll format it at the end...
Thank you all
Posted: Thu Dec 04, 2003 9:13 pm
by xisle
yeh I always store a timestamp and use
DATE_FORMAT() as well.. just giving him what he wants lol
twigletmac wrote:Why not store the date in a DATE field? It will make it a lot easier to manipulate, VARCHAR's very limited when it comes to dates and times. Then you just use DATE_FORMAT() to retrieve the date in whatever format you want.
Mac