1

I have this code

<div class="control-group {if error:birthdate}error{/if}">
        <label class="control-label" for="birthdate">{label:birthdate}</label>
        <div class="controls">
            {if logged_out}
                <input class="span2" data-title="Help" data-placement="right" data-trigger="focus" data-content="{instructions:birthdate}" required type="date" name="birthdate" value="{if '{exp:parameters:post name="birthdate"}'}{exp:parameters:post name="birthdate"}{/if}" id="birthdate">
            {if:else}
                {birthdate}
                <input class="span2" data-title="Help" data-placement="right" data-trigger="focus" data-content="{instructions:birthdate}" disabled type="date" value="{birthdate format="%Y-%m-%d"}" id="birthdate">
            {/if}
            {if error:birthdate}
                <span class="help-inline">{error:birthdate}</span>
            {/if}
        </div>
</div>

The problem is that while {birthdate} is outputting properly, {birthdate format="%Y-%m-%d"} is always outputting 1970-01-01.

Any idea why this is the case? I am using EE 2.5.5

UPDATE:

The actual value stored in the exp_channel_data is 503150405. Converting this timestamp using this site yielded

GMT: Wed, 11 Dec 1985 12:00:05 GMT

The output using {birthdate} yields

1985-12-12 12:00 AM

So I think the data is not the problem.

1

What is output by {birthdate} without adding any formatting?

What fieldtype are you using to store {birthdate}?

If you are using a text field, do you perhaps have the formatting set to Auto or XHTML which would cause an issue with the content being converted to a date and so fall back to the default of 1970-01-01

1
  • The output is something like 1985-12-12 12:00 AM. The fieldtype being used is Date. I am using an input tag with type="date" to display it. – developarvin Jul 17 '13 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.