try installing ntp
Current timestamp show 1 hour behind. Forge, Digital Ocean
Wonder if somebody can help me?
How do I manage the timezone of a Forge, Digital Ocean server?
I have just noticed that when updating a row the update_at timestamp saves to one hour behind which on the messaging system is a bit of a problem. I tried restarting the server just incase it had got out of step but that didn't change anything.
How does this work with daylight saving? I need it to sync up to UK time.
https://www.timeanddate.com/time/zone/uk/london
Thanks in advance!
It's a bit complicated, especially if you already have data in the db. Working with timezones can be a bit of a headache.
There is a timezone setting in app/config/app.php, which is set to UTC as default. Personally, that's what I use so all date/times in the database are using UTC.
When retrieving the dates/times from the db, I convert them to the users local timezone with carbon. created_at and updated_at are automatically converted to Carbon instances. You can add more fields in the $dates array of the model, if you have more custom date/time fields. My user table has a timezone field so they can set their local timezone (which does use daylight savings time if in effect for that tz).
So, for example, when outputting a date, I'd do something like:
echo $MyModel->updated_at->setTimezone($user->timezone)->format('n/j/Y');
But my app supports people in many timezones. If your app is only working with a particular timezone and all of the users are in that same timezone, you could just change the timezone setting in the config file, however that would only affect newly added dates to the db. All the existing dates in your database would then need to be updated to the new timezone.
Please or to participate in this conversation.