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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

How do I format the Date in DOM?

Go to End

2 Posts   1918 Views


Community Member, 125 Posts

7 October 2010 at 2:34am

Hi all,
As you can tell from my numinous post, I fumble around a lot here. Please forgive me in the abundance of my dumb questions.

I have a date field in the DOM table but it always shows the date like "2010-10-05", how can I format to something else?



Forum Moderator, 4102 Posts

7 October 2010 at 12:24pm

Easiest thing to do is create a custom getter..

public function getFormattedDate() {
return $this->obj('YourDateField')->Format('m-d-Y');

Then in your headings array, just use:

'FormattedDate' => 'Your date heading'

Silverstripe tips, tutorials, screencasts, and more.