ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Date Field in my template renders out on page as a number, not a date - "1102195443’

January 26, 2011 12:55am

Subscribe [3]
  • #1 / Jan 26, 2011 12:55am

    grounded

    138 posts

    Hello, I am putting together a news archive, and I have created a channel just for those entries. In that channel I have a template setup, a with a custom field group. IN the field group I have in order:
        • a ‘date field’ for a the date the news release was posted
        • a ‘Text Input Field’ for the title of the news release
        • a ‘Textarea’ field that contains the body of the news release.

    (3 fields in all for the template) I am calling the 3 fields in the template with the following code:

    {exp:channel:entries channel="pressreleasearchive"}
       <h1>{title}</h1>
     <strong>{DateOfEntry}</strong>
    
    
    
    
      <h2>{pressReleaseTitle}</h2>
    <p>  {PressReleaseBody}<br />
    {/exp:channel:entries}

    http://grounded4life2.dyndns.tv/onami/pics/dateField.png

    When i preview the entry on the page, I get this:

    http://grounded4life2.dyndns.tv/onami/pics/dateFieldHmm.png

    The date comes in as the number ‘1102195443’ and not a date at all?

    What could i be doing wrong? The rest of the fields in the field group work fine. I COULD change it to a standard text input field, but i will need to sort entries by date.

    More info:
        • In my entry edit page, I have the date field set to ‘fixed’, (but i tried ‘localized’ with no success as well)
        • I use the calendar picker to select the date, since the field is very sensitive to the format of the date
       

    Any help would be appreciated!
    Thx,
    Ed

    [Mod Edit: Moved to the EE 2 Technical Support forum]

  • #2 / Jan 26, 2011 6:08am

    Paul Stone

    97 posts

    Hi Ed,

    You need to tell EE how you want the date formatted (the number you’re seeing is the raw, Unix timestamp I think).

    http://ellislab.com/expressionengine/user-guide/templates/date_variable_formatting.html

    So you’ll probably need to put something like:

    {DateOfEntry format="%F %d %Y"}

    Hope that works,
    Paul.

  • #3 / Jan 26, 2011 2:29pm

    grounded

    138 posts

    FIXED thanks!!!!

  • #4 / Jan 26, 2011 3:31pm

    Ingmar

    29245 posts

    Excellent news. Please post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases