I have a problem with the dates, I just wonder if I can do something about it or wether it is a server issue:
all the dates we insert is inserted in the US format yyyy-mm-yy.
Can we insert it in the dd-mm-yyyy format just by using the DATE_FORMAT() withut needing to change the server setings (we dont have access to it).
If not we will need format it before INSERTING and after QUERYING each time and that would be...not good???
thanks,
date manipulation
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
I found the solution searching here at home last night. I don't have the link, but it was something like:
Something like that... I'll take a looksy when I get home and if it is wrong I'll correct myself.

Code: Select all
<?php
$getDate = mysql_query("SELECT DATE_FORMAT('theDate', '%c-%e-%y') AS theDate FROM the_table";
$row = mysql_fetch_array($getDate, MYSQL_ASSOC);
$newDate = $row['theDate'];
echo $newDate;
?>