Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

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

Better way to use date class?

Go to End

2 Posts   878 Views


Community Member, 130 Posts

1 December 2010 at 11:11am

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?



Forum Moderator, 5523 Posts

1 December 2010 at 11:55am

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.