Date Field Format

5 posts by 2 authors in: Forums > CMS Builder
Last Post: September 10, 2010   (RSS)

I have a newsletter section that I'm building, and I want to sort the archives into groups by year to make them easier to find and make the list easier to read (instead of one big giant list of links). Each year will have a heading that says "{year} Issues".

Pure HTML Static Demo Link: http://66.39.41.59/the-voice.php

What I want to know is how CMS Builder stores the date so that I can list the right issues under the right heading.

Thanks!
-----
~Jessica Sullivan, Crystal Realm Designs.

Re: [Duches77] Date Field Format

By Jason - September 10, 2010

Hi,

CMS Builder stores the date in a field called createdDate using this format:
YYYY-MM-DD hh:mm:ss

If you want to select the record of just a specific year, you could use something like this:

Example (2009 records)

list($newsletterRecords,$newsletterMetaData)=getRecords(array(
'tableName' => 'newsletter',
'allowSearch' => false,
'where' => "createdDate LIKE '2009%'",
));


You'll need to change names to match what you have in the database.

Hope this helps. Let me know if you have any more 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/

Re: [Jason] Date Field Format

Would this work also for a user defined date field? I'm going to be adding a lot of back issues, so the created date for the record will be different than the original published date.

Thanks! [laugh]
-----
~Jessica Sullivan, Crystal Realm Designs.

Re: [Duches77] Date Field Format

By Jason - September 10, 2010

Hi,

Yes, any date field you add in CMS Builder would be stored the same way, so you could just replace createdDate with the name of whichever date field you want.

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/