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.

Archive

Our old forums are still available as a read-only archive.

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

Dates showing as 1969! Please help!


Reply

10 Posts   3804 Views

Avatar
Blackdog

9 October 2008 at 4:33pm (Last edited: 9 October 2008 4:36pm), Community Member, 156 Posts

You might find Date as a field name is a clash with a mysql reserved word.

try using

"PostDate" => "Date"

$fields->addFieldToTab('Root.Content.Main', new CalendarDateField(PostDate, 'Date'), 'Content');

the do a flush and see if it works.. remember to change the $Date to $PostDate in your template.

Avatar
Phalkunz

9 October 2008 at 6:34pm 69 Posts

It looks all good to me. Anyways, try

new CalendarDateField('Date')

instead of

new CalendarDateField('Date', 'Date')

and populate the default using the following code:

public function populateDefaults(){
   parent::populateDefaults();
   $this->Date = date("Y-m-d H:i:s",time());
}