[Phpwm] strtotime() date format

Phil Beynon phil at infolinkelectronics.co.uk
Tue Sep 18 17:25:17 BST 2007

> Greg Jones wrote:
> > As long as you're not on windows, you can use strptime to parse a date
> > for a given format, which you could reformat as something acceptable
> > to strtotime. The way it parses is a little odd though (zero-indexed
> > months, years since 1900)  and the formatting isn't that used by
> > date(), so if your date-format is always going to be d/m/(y|Y) it's
> > probably just easier to re-order it with string functions.
> Ah, I'd not come across strptime() before. It looks useful, although it
> would seem to be better if they merged such functionality with e.g.
> date_parse()
> David.
> - --
> David Goodwin

I always thought, and have always done it this way, that you converted the
year / date / time into the number of milliseconds since whenever year /
date / time it was that UNIX defined was zero then did all the manipulations
in that then converted it back with the result appearing in whichever format
that you needed / wanted it to be. Thus it would sort out all the nonsense
like leap years and the like automagically.

Might be worth pointing out, though perhaps it can confuse the issue, that
there are some neat time manipulation bits in MySQL  which can easily be
returned to PHP as variables.......... though it always seems the bit of
functionality you want to use is always in the next version step up of MySQL
that's currently installed on the server.....

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.22/1013 - Release Date: 17/09/2007

More information about the Phpwm mailing list