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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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   933 Views

Avatar
digibrains

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?

Chris.b

Avatar
Willr

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.