I have a database with an entity
table and a users
table. The entity table has fields for created_at
and updated_at
. The
You need to use the Carbon function copy()
to keep the timezone unchanged on your object. Then you can just set the timezone to whatever you want and 'output' the result.
$entity->created_at->copy()->tz(Auth::user()->timezone)->format('M j, Y \\a\\t g:i A');
As for timezones - it is just PHP timezones.
$tzlist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);