Jump to content

[SOLVED] If between two dates do this


mrjonnytou

Recommended Posts

Hi,

 

I'm struggling with the syntax when it comes to checking if a given date lies between two dates.

 

my code so far

 

$deadline = strtotime($date);

$now = time();

$six_months = $now + 60*60*24*180;

$one_year = $now + 60*60*24*360;

$three_years = $now + 60*60*24*1080;

 

if ($deadline => $now && =< $six_months){

//do something

}

elseif ($deadline >= $six_months && <= $one_year){

//do something

}

elseif ($deadline >= $six_months && <= $three_years){

//do something else

}

 

Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/113738-solved-if-between-two-dates-do-this/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.