You are here: Re: strtotime("2007 Jul 10") fails « PHP Programming Language « IT news, forums, messages
Re: strtotime("2007 Jul 10") fails

Posted by Jack on 07/10/07 19:16

On Jul 10, 10:16 am, Brian Kendig <b...@enchanter.net> wrote:
> I'm working with dates in several formats including 'yyyy MMM dd', but
> strtotime doesn't recognize this format and returns FALSE.
>
> Is there a direct way to convert times from this format into
> timestamps, other than my having to whip up a simple parsing routine?
>
> My headache is that I use strtotime in a lot of places in a lot of
> files, and I'd hate to have to add a wrapper everyplace I use it. I
> wish there were a way to extend strtotime's default functionality, but
> I know that would involve hacking the PHP source code.

as far as I know there is no direct way. so what you need to do is cut
the first 5 char ('YYYY ') and append it to the end and then call
strtotime on the new string. You don't need to do anything to the mmm
since the strtotime will recognize it.

 

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

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