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, biapar, Willr, Ingo, swaiba, simon_w

Better way to use date class?


Reply


2 Posts   708 Views

Avatar
prawnstar

Community Member, 127 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?

Chris.b

Avatar
Willr

Forum Moderator, 5513 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.