Re: $date1 larger then current date?

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

 



Try:

if ($date1 > $date2) {
   echo "First date is a later one than Second date";
} else {
   echo "Second date is the latest.";
}

It's just as easy as you thought it'd be.

Mike


Gustav Wiberg skrev:
Hi guys!

I'm searching for what I thought would be an easy issue comparing dates. I just want to know if a date in variable $date1 is larger then current date. I use the format YYYY-MM-DD in $date1
and I know how to retrieve the current date and set it in $dat2
But how do I know if $date1> $date2 ? I have looked around, but I havent found any easy solution. It seems to be a big deal? Is that the case?
Best regards
/Gustav Wiberg

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux