RE: Date Comparison

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Stuart - 

RTFM yourself....I did read it, and obviously misunderstood...

I'm really sorry to bother you. I thought that was what a listserv like this was for - to ask questions...

I'll try not to ask questions I should know the answer to next time.


-----Original Message-----
From: Stuart [mailto:stuttle@xxxxxxxxx] 
Sent: Friday, August 28, 2009 10:19 AM
To: David Stoltz
Cc: php-general@xxxxxxxxxxxxx
Subject: Re:  Date Comparison

2009/8/28 David Stoltz <Dstoltz@xxxxxxx>:
> How to I ensure a variable date is not in the past, compared to the
> current date? Here's how I'm trying, unsuccessfully:
>
> $nextdate = "8/2/2009";
>
> if(strtotime($nextdate)<=getdate()){
>
>        echo "Sorry, your next evaluation date cannot be in the past,
> Click BACK to continue.";
>        exit;
>
> }

RTFM.

The strtotime function will give you a timestamp, getdate will give
you an array, so your comparison is non-sensical. Use the time
function to get the current date/time as a timestamp.

-Stuart

-- 
http://stut.net/


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux