Jump to:

22977 Posts in 11806 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Better way to use date class?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 614 Views
  • prawnstar
    Avatar
    Community Member
    116 Posts

    Better way to use date class? Link to this post

    There has to be a better way to print a date like this, Oct 31, 2010 than this:

    $Date.Format(M d), $Date.Format(Y)


    If I use:

    $Date.Format(M d, Y)


    SS prints something like Oct 31. No year.

    Any Ideas?

    Chris.b

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Better way to use date class? Link to this post

    Sadly this is a current limitation of the templating engine. commas indicate separate arguments and I'm pretty sure you cannot use quotes around the string or even escape it. Allowing $Date.Format("M, d, y") with quote marks would be a huge improvement to ssviewer.

    614 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.