mardi 3 janvier 2017

php check if date is today or greater. but only in this month

I have a list of dates and need to enforce a limit, which is the list to not be older than today but more than 30 days ahead of today.

Is possible to modify what I have or do I need to use something like 'time' instead? if so how would I adjust what I have?

$date = new DateTime($page->meta_value);


  if (strtotime($page->meta_value) > time()) {
  echo '<h2><div class="date-title">';
  echo $page->post_title.' - ';
  echo '</div><div class="date-date">';
  echo $date->format('d-m-Y').'<br/>';
  echo '</div></h2>';
  }

Thanks for reading :)

Aucun commentaire:

Enregistrer un commentaire