Ad

October CMS, How To Change Date Format In Template?

- 1 answer

I'm use code: {{operation.updated_at->format('d.m.Y H:i')}} , but this not working.

Ad

Answer

You should try to add this in your operation model :

public function getUpdatedAtAttribute($date)
  {
      return Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $date)->format('d.m.Y H:i');
  }

Every time you use these properties from your model to show a date these will be presented differently.

$operation= Operation::find(1);
echo $operation->updated_at; // d.m.Y H:i will be displayed
Ad
source: stackoverflow.com
Ad