Default date showing even though no entry made in CMSB

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 14, 2013   (RSS)

Hi Benedict,

Here's an excerpt from a recipe in my CMSB Cookbook http://www.thecmsbcookbook.com that might help.

If you try to test for a blank date with a simple:

_____ code ________________________________________________

<?php if ($your_tableRecord['your_date_field']): ?>

__________________________________________________________

The test won’t work as you expect, since there is actually a date value stored in your database, (0000-00-00 00:00:00)

Until this glitch is fixed, and you update to the “fixed” version, you’ll have to format your test like this:

_____ code ________________________________________________

<?php if ($your_tableRecord['your_date_field'] && $your_tableRecord['your_date_field'] != '0000-00-00 00:00:00'): ?>

__________________________________________________________

You can learn more about date formatting at:

http://www.php.net/date

You might also try the free plugin attached that Dave Edis created a long time ago.

Hope that helps,

Jerry Kornbluth


The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Thanks Gerry, that plugin did the trick instantly. Appreciate the explanation.