> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: 22 May 2007 15:47 > To: mysql@lists.mysql.com > Subject: a function to convert a uk date to and from mysql date > > > Hi, > > My UK dates are this format DD/MM/YYYY I want it reversed and > then the seperator changed so it becomes YYYY-MM-DD > > I use this PHP at the moment > > $available_from = implode('/', array_reverse(explode('-', > $available_from))); > > Ta, > > R. >
First question, if the PHP works, why are you asking here for an answer? Assuming you now want to do this transformation at the database layer, select the three date components out separately with the string functions and then use DATE_FORMAT() to print them how you want. http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function _date-format Edward -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]