Page 1 of 1

date postgres and php

Posted: Tue May 06, 2003 4:24 pm
by soshea
any suggestions on this would be appreciated:
when selecting a date from a table on a postgres DB the date is returned in this format:
2003-05-06
i would like to change the date when outputted with PHP to:
05/06/2003 (or any other format that i would like)
can you reformat the date with postgres or am i going to have to explode it with php?
select date_format(mm/dd/yyyy,inevents_date) from events
or
explode('-'.$data[inevents_date])
any ideas?????
(examples would be great!!)

Posted: Tue May 06, 2003 5:15 pm
by []InTeR[]
not tested:
$date = implode("/",array_reverse(explode("-",$date)));

Posted: Wed May 07, 2003 4:02 am
by twigletmac
If you can do it in the database though, that would be the best solution.

I did a Google, and found these:
http://www.oreilly.com/news/sqlnut_1200.html
http://forums.devshed.com/archive/21/2002/10/2/44536

Mac