[Phpwm] strtotime() date format

Alex Mace alex at hollytree.co.uk
Wed Sep 19 09:05:49 BST 2007

I think that is the issue - that you have some data that you want to convert
to a Unix timestamp, but the function that does it (strtotime) requires it
in the US date format. So a UK user will input it in dd/mm/yyyy but the
function wants mm/dd/yyyy. Personally, I usually give the user drop downs to
select a date to try and prevent some dodgy dates getting in and then store
it in yyyy-mm-dd as strtotime will take that as well, it's easy to store in
MySQL and you can use it to order by date...

On 18/09/2007, Phil Beynon <phil at infolinkelectronics.co.uk> wrote:
> > 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
> that's currently installed on the server.....
> Phil
> 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
> 13:29
> _______________________________________________
> Phpwm mailing list
> Phpwm at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/phpwm

More information about the Phpwm mailing list