You are here: Re: Date stored in DB in the following format: 2004-06-29 09:06:36+01 « PHP Programming Language « IT news, forums, messages
Re: Date stored in DB in the following format: 2004-06-29 09:06:36+01

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация