David Stoltz wrote:
> I'm really struggling with dates in PHP. (Yes, I tried reading the
> manual)...
> Can someone provide code that does this:
> Takes current date, assigns it to a variable (let's say $today)
> Then adds 30 days to $today variable
> Takes a string ($nexteval) like '8/26/2009' and compare it to $today.
> The variable $nexteval must be greater than $today (which is today + 30
> days) or a message is echoed.
> I'm finding this difficult to do, but I'm coming from an ASP background.
> Any help appreciated.

Look at the date/time functions, they are very feature rich:

$today = time();
$nexteval = strtotime('+30 days', $today);

if ($today > $nexteval) {
        echo 'Message';


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to