Help with end date coding

3 posts by 2 authors in: Forums > CMS Builder
Last Post: September 17, 2015   (RSS)

By dlsweb - September 17, 2015

I'd really appreciate some help.
I have an end_date field that should only show if an end date has been entered.
Database default entry is "0000-00-00 00:00:00"

Can someone give me the coding to show end_date only if a date has been entered?
Thanks

By gregThomas - September 17, 2015

Hey dlsweb,

I normally use something like this:

  <?php
  
    if($record['date'] && $record['date'] != '0000-00-00 00:00:00'){
      echo $record['date'];
    }
    
  ?>

So the code above checks that we have a date set and that the date does not equal 0000-00-00 00:00:00, then displays that date if one is set.

Let me know if you have any questions. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com