|  | Posted by Alvaro G. Vicario on 07/25/06 18:20 
*** Bob Sanderson escribió/wrote (Tue, 25 Jul 2006 12:49:17 GMT):> I have a field in a database called DateRcvd. At present, it outputs in my
 > report in the yyyy-mm-dd format. I would like it to display in the dd/mm/yy
 > format. What is the easiest way to accomplish this?
 
 I particularly find it easier to handle dates as Unix timestamps. You don't
 say what your DBMS is so I'll assume MySQL:
 
 SELECT UNIX_TIMESTAMP(DateRcvd) FROM table
 
 Once you read the value into a PHP variable, you can use almost date
 function to format it, such as date() or strftime().
 
 When you need to insert dates into MySQL:
 
 INSERT INTO table (DateRcvd) VALUES (FROM_UNIXTIME(1153851613))
 
 
 --
 -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
 ++ Mi sitio sobre programación web: http://bits.demogracia.com
 +- Mi web de humor con rayos UVA: http://www.demogracia.com
 --
  Navigation: [Reply to this message] |