...

View Full Version : Date Comparisons



holty
09-09-2003, 10:04 AM
I would like to pull some info from an error file....

The date is stored like: Aug 18 2003.

I have a html form with 2 dates - from and to.

If I put these input dates in the same format, I can't compare is it gives funny answers!

If I make the input dates like 16/08/2003 and 20/08/2003, how can I convert the date in the error file to look like this?

Thanks

mordred
09-09-2003, 11:28 AM
Ehm.. are these two separate questions is the last one only needed if you don't get the date comparisons to work?

Usually you convert a date into an integer called UNIX timestamp. It's just a big number and stands for the seconds passed since the date in question and 1.1.1970.

To convert your date, you could use



$time = strtotime('Aug 18 2003');


After that, you can compare each date with others to see which one is greater or lower or whatever. :)

holty
09-09-2003, 02:30 PM
Thanks - thats exactly what i'm after...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum