Reputation: 4424
I have the following code:
class Page_Controller extends ContentController
{
public function TimeNow() {
return date('Y-m-d H:i:s');
}
}
But the following template code doesn't work:
$TimeNow.Format(Ymd\THis)
I'm guessing this is because TimeNow
isn't cast as an SS_Datetime
object (which inherits the Format
method).
How do I cast TimeNow
as SS_Datetime
?
Upvotes: 2
Views: 126
Reputation: 1082
Do this instead:
public function TimeNow() {
return SS_DateTime::now();
}
Upvotes: 5