Copied to clipboard

Flag this post as spam?

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


  • Alexandru 112 posts 272 karma points
    Sep 27, 2013 @ 13:07
    Alexandru
    0

    How do I format a blog post Date

    I am working on a blog and at the moment, on the homepage, I print out the post dates for each blog post through XSLT. However when I open up the blog post page. the date is printed using HTML like this:

    <umbraco:item field="postDate" useifempty="createDate" formatasdate="true" runat="server" />
    

    which means the date is formatted as this: Wednesday, September 18, 2013.

    How can I change the way the date is formatted while still using HTML?

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Sep 27, 2013 @ 13:28
    Dennis Aaen
    0

    Hi Alexandru,

    I think you have to do somehing simlar to  this: If you wan´t to do it in you templates. Then I coundn´t find how to print a specific field insted of the current date.

    <p id="footer_text"class="address">© <%=umbraco.library.FormatDateTime(umbraco.library.CurrentDate(),"yyyy")%> Client Sitep>

    Other alternative you could do it in a XSLT file, an the place the macro for the XSLT file, where you have to print the date.

    <xsl:value-of select="umbraco.library:FormatDateTime($currentPage/postDate, 'd MMMM, yyyy')"/>

    The documentation for this can be found here:

    http://our.umbraco.org/wiki/reference/umbracolibrary/formatdatetime

    Hope this can help you to find a solution.

    /Dennis

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Sep 27, 2013 @ 13:52
    Dennis Aaen
    100

    Hi agin efter som more searh I found something I think will work for you.

    <umbraco:Item runat="server"field="postDate" xslt="umbraco.library:FormatDateTime({0},'dd-MM-yyyy')"/>

    So try to see if this will solve your problem, or you could use the XSLT way, as I said i my first post.

    /Dennis



  • Alexandru 112 posts 272 karma points
    Sep 27, 2013 @ 13:54
    Alexandru
    0

    Thanks! solved it using the 1st piece of code you gave me. However, this looks a tiny bit cleaner :)

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Sep 27, 2013 @ 14:01
    Dennis Aaen
    0

    Okay I´m glad that I could help you.

    I think you should remember to mark this post as solved, so others with the same problem, can see what´s worked for you.

    If you don´t know how do mark a post as resoved, then I can guide you through it

    /Dennis

  • Alexandru 112 posts 272 karma points
    Sep 27, 2013 @ 15:50
    Alexandru
    0

    Honestly, I have no idea. Let me know how and I will do it :). Thanks again

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Sep 27, 2013 @ 16:13
    Dennis Aaen
    0

    Hi Alexandru,

    When you find the right answer, under the person who have give you the solution, to the problem, there is a green tick. I have made a screenshot from one of my posts to show you where to find the green tick. Then click on it.

    /Dennis

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies