|
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]
|