Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » How do I format the Date in DOM?

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 1547 Views
  • otherjohn
    Community Member
    125 Posts

    How do I format the Date in DOM? Link to this post

    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?


  • UncleCheese
    4085 Posts

    Re: How do I format the Date in DOM? Link to this post

    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. http://www.leftandmain.com

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.