Hi i want to get user local timezone and then set that timezone as default in php.
For example if i am from Pakistan i will get local timezone Asia/Karachi
then i will set that timezone in php like this
date_default_timezone_set("Asia/Karachi");
if some other user is from different country like usa or england then we will get their local timezones and set them in php
i want this solution because i want to convert date to unixtimestamp
if date is 2016-13-07
and if i use strtotime('2016-13-07 ');
then it give me different unix string for different timezones in php
@usamamashkoor Your application’s timezone is stored in your config/app.php file. If you want to override this for users, then you’ll need to do it in a service provider or something.
Beware that this uses the user timezone SETTING, not the users current location (though it should be identical in most situations).
Another - but seemingly less reliable - apporach would be to use an IP lookup to determine the users timezone.
@EventFellows how i can access this in PHP because Javascript is client Side and PHP is server side,
I want to set the timezone in the Class constructor when the page Loads in php