Wrong Year when using dates...

I'm using  <w:date format="%Y">  and keep getting 2010 as output... i'm sure it's 2011! ;)

Have more questions? Submit a request

1 Comments

  • 0
    Avatar
    Christopher Haupt

    The date tag's behavior is somewhat dependent on the context in which it is being called. Per your example, it will either return the published_at date of the current page OR the date of a database item.

    If you just want to get the CURRENT date based on the calendar, add the "for" attribute with the value of "now":

    <w:date format="%Y" for="now" />

    If using the "now" value, remember if the page is cached, it might show the wrong time/date until the next time the page is re-rendered. This is probably not an issue for the "year", though!

Please sign in to leave a comment.
Powered by Zendesk