Hi there,
I'm currently playing around with a DataObject. The DataObject has a date field in the database:
static $db = array(
'Date' => 'Date'
);
Now, in the frontend I can access the Date via "$Date" and can set a custom format in the template using e.g.
$Date.Format(d.m.Y)
But how is it possible to use the custom user settings? - Every user can change his preferred time and date format in the backend. But how is it possible for me to use this in the frontend?
Something like
public function Date() {
if(Member::currentUser() && Member::currentUser()->ID) {
return date(Member::currentUser()->DateFormat, strtotime($this->Date));
}
return $this->Date;
}
is not possible because the DateFormat in the Member Object was not stored in the php way to use date functions.