Posted by Chris Hope on 07/08/05 13:27
bissatch@yahoo.co.uk wrote:
> I am trying to convert a date in the following format with the date
> function (i.e. date("d/m/y", strtotime($dbdate));):
>
> 2004-06-29 09:06:36+01
>
> The database was created by another programmer as I normally store my
> dates as datetime type in the format:
>
> 2005-07-08 10:52:44
>
> Any help? Cheers
It will actually work as-is, although the +01 is a timezone offset so
may give you unexpected results depending on the time of day (which may
of course be the intention).
If you want to remove the +01 at the end then use substr() to get rid of
it eg date("d/m/y", strtotime(substr($dbdate, 0, 19))); Or you could do
it in the database query itself.
--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
[Back to original message]
|