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.

Blog Module /

Discuss the Blog Module.

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

New Blog Entry date


Go to End


5 Posts   1819 Views

Avatar
purtle

Community Member, 11 Posts

16 January 2012 at 1:52pm

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.

Avatar
Optic Blaze

Community Member, 190 Posts

9 March 2012 at 12:37pm

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.

Avatar
purtle

Community Member, 11 Posts

9 March 2012 at 1:24pm

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.

Avatar
Optic Blaze

Community Member, 190 Posts

9 March 2012 at 8:29pm

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.

Avatar
purtle

Community Member, 11 Posts

10 March 2012 at 4:06pm

Hi Optic Blaze,

Your solution worked great :)

Really appreciate your help!