Re: If date is greater than

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

 




Thanks,

Bastien

> On Oct 19, 2013, at 10:44 PM, John Taylor-Johnston <jt.johnston@xxxxxxxxxxxxxx> wrote:
> 
> I have date strings in my mysql db. yyyy-mm-dd.
> I want to parse to see if the date is greater than november 2011 and less than december 2012.
> 
> Is this the right approach? How bad is my syntax?
> 
> |function dates_range($todaynow)
> { |
> |$date1=strtotime("2011-11-01");
> $date2=strtotime("2012-12-31");
>       if (|||($|||||todaynow |>= $date1) and |||||($|||||||todaynow| <= $date2)||)
> ||       {
> ||       # do something
> ||||       }
> }
> |||

Easiest to convert to integers and then compare
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






[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