No date = 12/31/69 ?

7 posts by 4 authors in: Forums > CMS Builder
Last Post: October 29, 2010   (RSS)

By zip222 - October 27, 2010

One of my section editors has an optional date field, but if you leave it blank it stores the date of 12/31/69. Why does this happen, and is there a way around this?

Re: [zip222] No date = 12/31/69 ?

By Jason - October 27, 2010

Hi,

This happens when you pass a 0 value into the date() function. Is this value getting in from an html form? If so, please attach the .php page that you're working with and I can take a look at it.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] No date = 12/31/69 ?

By zip222 - October 27, 2010

No it's not coming from an HTML form, it's happening entirely within CMS Builder.

Re: [zip222] No date = 12/31/69 ?

By Jason - October 27, 2010

Hi,

Okay, if you could fill out a second level support request here:
https://www.interactivetools.com/support/email_support_form.php
I can take a closer look at this. In your request, please indicate which field in which section is experiencing the problem.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] No date = 12/31/69 ?

By zip222 - October 27, 2010

Submitted. Thanks.

Re: [Jason] No date = 12/31/69 ?

By Damon - October 27, 2010

For anyone else following this thread, here is the IF statement code to handle blank dates in templates:

<?php if($record['date'] != "0000-00-00 00:00:00") : ?>
<?php echo date("D, M jS, Y g:i:s a", strtotime($record['date'])); ?>
<?php endif; ?>


It will only output the date if it has a value.
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/