Re: Date question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wed, 10 Sep 2003, Grant Henderson wrote:

> How do I convert a postrgesql timestamp
> To an english date
> 
> E.g.
> 	$order_date = "2003-09-10 09:40:30+01";
> 	$date = date("d/M/Y", $order_date);
> 	print($date);

You can either split out the parts and use mktime to get a timestamp, then 
feed that timestamp to date(), or you can do it in postgresql with 
something like SET DateStyle TO 'US' and then see how they come out.

Finally, you could use the extract() function to pull the date in the 
format you want ahead of time:

select extract(YEAR from field)||'/'||extract(MONTH from 
field)||'/'||extract(day from field);

And get it that way.



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux