View Full Version : problem comparing 2 dates

02-27-2007, 08:32 AM

I am having problems comparing two dates.

I have this code


# creates Unix timestamp time for date('d-m-Y')
$server_date=mktime (0,0,0,$server_date_array[1],$server_date_array[0],$server_date_array[2],0);

# creates Unix timestamp for $exp_date
$exp_date_stamp=mktime (0,0,0,$exp_date_stamp_array[1],$exp_date_stamp_array[0],$exp_date_stamp_array[2],0);

# compare Unix timestamp
if ( $exp_date_stamp <= $server_date ) {
echo "EXPIRED" ;

echo "VALID" ;


It creates a Unix timestamp for date() and $exp_date
then compare the 2 Unix timestamp to verifiy if $exp_date is valid or expired (compared with current date)

It works on my computer without problems (returning VALID) .

On some unix server where the server date was
Tue Feb 27 01:56:46 WIT 2007

the scripts returned EXPIRED instead of VALID .

Anyone can tell me why ? What's wrong on my code ?

Thank you!

02-27-2007, 04:15 PM
Looks OK from here... what do you see when you echo all the variables?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum