For Programmers: Free Programming Magazines  


Home > Archive > PHP on Windows > April 2007 > Re: [PHP-WIN] $date1 larger then current date?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-WIN] $date1 larger then current date?
Mikael Grön

2007-04-25, 3:59 am

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
>
>
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com