Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Garrett Fisher 341 posts 496 karma points
    May 19, 2010 @ 15:42
    Garrett Fisher
    0

    Formatting dates in Templates

    Hi,

    I know how to format a date in an XSLT file, but how in a (.master) template?  When I choose "Insert Page Field," the only date-related option I see is "Format as date," but that automatically formats it as January 1, 2010.  Can I specify in my <umbraco:item> tag the format I want?

    Thanks in advance,

    Garrett

  • Jeff Grine 149 posts 189 karma points
    May 19, 2010 @ 15:44
    Jeff Grine
    0

    Inline xslt is probably your best bet. Good example here.

  • dandrayne 1138 posts 2262 karma points
    May 19, 2010 @ 15:44
    dandrayne
    3

    You could use

    xslt="umbraco.library:FormatDateTime({0}, 'Y MMM')"

    etc. inside your umbraco:item tag

    <umbraco:Item field="yourDate" runat="server" xslt="umbraco.library:FormatDateTime({0}, 'Y MMM')" ></umbraco:Item>

    untested, but should work

    Dan

  • Garrett Fisher 341 posts 496 karma points
    May 19, 2010 @ 17:35
    Garrett Fisher
    0

    AH YES! I keep forgetting about the xslt="" attribute.  Thanks as always, @dandrayne. 

Please Sign in or register to post replies

Write your reply to:

Draft