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!


Go to End
Reply


10 Posts   3856 Views

Avatar
Blackdog

Community Member, 156 Posts

9 October 2008 at 4:33pm

Edited: 09/10/2008 4:36pm

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

69 Posts

9 October 2008 at 6:34pm

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());
}

Go to Top