Laravel 5.3 : Setting time zones based on users location

我只是一个虾纸丫 提交于 2019-12-12 18:47:36

问题


We have small blog application in Laravel 5.3 in which i need some suggestion about setting time stamps on the following features

1.Admin can able to send notifications to all users with current time stamp (server timezone is Asia/Calcutta) user will see all the notifications based on their time zones.

2.Users can add posts along with their current time stamps , when other users see that posts based on their time zones.

So what are the changes i need to do on the timezone settings in my application??


回答1:


You might have already found an answer to your 7 months old question. Anyway, I am just posting here what I did to get rid of different time zone issue.

First read Timo Huovinen answer.

In my application, user should manually set the timezone. Based on it, convert MySQL time to appropriate timezone before sending it to client.

You can use convert_tz() function to convert between timezones.



来源:https://stackoverflow.com/questions/42062555/laravel-5-3-setting-time-zones-based-on-users-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!