RE: [PHP] Date check
| From: | Jon Haworth | Date: | Tue, 11 Feb 2003 17:24:51 +0000 |
| Subject: | RE: [PHP] Date check | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-135214@lists.php.net to get a copy of this message | ||
Hi Fredik,
> I have to dates that i want to check who is biggest.
>
> This does not work:
> if( $date1 > $date2){
> ....
>
> How can i check them?
Presumably they're in SQL format, or something similar?
The easiest way is to convert them to unix timestamps (look into the date()
and mktime() functions to see how this is done).
Timestamps are integers representing the number of seconds since 1st January
1970, so comparisons are extremely easy :-)
Cheers
Jon