Skip to content

Instantly share code, notes, and snippets.

@0x1ad2
Last active May 12, 2016 12:13
Show Gist options
  • Save 0x1ad2/65fa0b75341002d04c8d037f45c00fce to your computer and use it in GitHub Desktop.
Save 0x1ad2/65fa0b75341002d04c8d037f45c00fce to your computer and use it in GitHub Desktop.
Dutch date mutator eloquent model
<?php
/**
* Get created at attribute and mutate to Dutch format and Dutch timezone
*/
public function getCreatedAtAttribute($date)
{
return \Carbon::createFromFormat('Y-m-d H:i:s', $date)->copy()->tz('Europe/Amsterdam')->format('d-m-Y H:i:s');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment