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.

SafeCracker Formatting a Date Field format="%d/%m/%Y" = 01/01/1970

October 09, 2012 5:49am

Subscribe [1]
  • #1 / Oct 09, 2012 5:49am

    aa146214

    2 posts

    Hi I am trying to format my date field which is called {member_birthday} with the format attribute. But whenever I apply the attribute to the tag it shows the date in the correct format but the with an incorrect date.

    <input type="text" name="display_birthday" id="display_birthday" value="{member_birthday}" maxlength="23" size="25"/>

    Displays the correct date i.e 1982-11-08 12:00 AM

    <input type="text" name="display_birthday" id="display_birthday" value="{member_birthday format="%d/%m/%Y"}" maxlength="23" size="25"/>

    Displays an incorrect date i.e 01/01/1970

  • #2 / Oct 10, 2012 4:39pm

    Kevin Smith

    4784 posts

    Hi aa146214,

    Is member_birthday a Date type channel field? In other words, it’s not just a regular Text Input field right?

    I ask because a Date field stores its data as a unix timestamp (like 1349901266), and that’s what it’ll output if you just use {member_birthday} in the template. Since your template is outputting a formatted date without any format parameter, it has me concerned that something is off. Could you let me know how this date field is set up?

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

ExpressionEngine News!

#eecms, #events, #releases