Jump to content

More than 12mths using %m


ScoobyDont

Recommended Posts

Hi

 

Is it possible to go above 12mths using %m, so for example 5 years = 60mths

 

I am using this code to change the colour of panels which works ok until I make the due date 1yr 2 mths away it makes the panel go red, I need it to stay green and echo 14 mths

<?php
$expire = $dates->datedue;    
$date = new DateTime($expire);
$now = new DateTime();
?>

<div class="col-md-3">
  <div class="panel 
	<?php 
	if ($now->diff($date)->format("%m") < 3) 
	 {
          echo 'panel-red';	
	 } else if ($now->diff($date)->format("%m") < 6) 
         {
	  echo 'panel-orange';}
	else {
	   echo 'panel-green';
	    }
	?>">
          <div class="dark-overlay">Due Date</div>
		<div class="panel-body">
                    <h4 class="duedate"><?php echo $now->diff($date)->format("%m Months");?></h4>
                  </div>
		</div>
	<?php 
	  if ($now->diff($date)->format("%m") < 3) 
	   {
	   echo '<div class="text-center"><button class="btn btn-success"> Book Now</button></div>';	
	   }
         ?> 
</div>

So the question is

 

Is it possible to have more than 12mths?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.