Jump to:

1855 Posts in 1609 Topics by 562 members

Blog Module

SilverStripe Forums » Blog Module » New Blog Entry date

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 758 Views
  • purtle
    Avatar
    Community Member
    4 Posts

    New Blog Entry date Link to this post

    Hi

    Just wondering if there is a way to fix the the New Blog Entry date, to change its default entry date from 1 Jan 1970, to always be the current day/date etc?

    Any help appreciated.

  • Optic Blaze
    Avatar
    Community Member
    162 Posts

    Re: New Blog Entry date Link to this post

    Hi, what version of the Blog are you using. Version 0.4.1's new entry date defaults to today's date on my installation.

  • purtle
    Avatar
    Community Member
    4 Posts

    Re: New Blog Entry date Link to this post

    Hi Optic Blaze,

    Yes, using version 0.4.1

    I can see that the default date should be set to the current date, however it seems to be overridden and always set to 1 Jan 1970.

  • Optic Blaze
    Avatar
    Community Member
    162 Posts

    Re: New Blog Entry date Link to this post

    Hi,

    The default date is for the Blog is set in the BlogEntry.php file on line 65.
    The line reads '$this->setField('Date', date('Y-m-d H:i:s', strtotime('now')));'

    Try removing the 'strtotime' parameter so that it now reads: '$this->setField('Date', date('Y-m-d H:i:s'))' then run dev/build and go to the blog and create a new entry.... see if that helps.

  • purtle
    Avatar
    Community Member
    4 Posts

    Re: New Blog Entry date Link to this post

    Hi Optic Blaze,

    Your solution worked great

    Really appreciate your help!

    758 Views
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.