Jump to:

23550 Posts in 19336 Topics by 2890 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: 672 Views
  • prawnstar
    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?


  • Willr
    Forum Moderator
    5511 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.

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.