Change Date Format in createdDate and updatedDate fields

3 posts by 2 authors in: Forums > CMS Builder
Last Post: November 29, 2010   (RSS)

Hi All,

Does anyone know how to change the format of the createdDate and updatedDate fields in a viewer?

Right now the date displays as YYYY-MM-DD followed by the time in 24 hour time as hh:mm:ss

Date format in the Admin section doesn't seem to affect this.

I'd rather change the code in the viewer then "Under the Hood".

Thanks,

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

Re: [gkornbluth] Change Date Format in createdDate and updatedDate fields

By Jason - November 29, 2010

Hi Jerry,

The date format in the admin section only affects how the date is displayed, not how the date is stored.

If you're wanted to affect how it's displayed inside CMSB, you can use the setting in admin to set it as either "Month Day Year" or "Day Month Year". We currently don't have the ability to format the time, though we can change that with some customization. Let me know if you'd like us to look into that for you.

If you want to format the date on pages outside CMS Builder, you can do that using the php date functions:

[url http://ca.php.net/manual/en/function.date.php]http://ca.php.net/manual/en/function.date.php[/url]

Example:
<?php echo date("m/d/Y",strtotime($record['createdDate']);?>

Hope this helps.

Let me know if you have any questions.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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