i have simple php script where i have this variable
$date = date('Y-m-d', time());
The Problem: The variable is storing date as per my server timezone.
What is want: I want to store date as per user time zone, take a look into
example below:
1- tom checkin from USA
2- jenne checkin from Asia since there is 12 hrs. difference so the date will be different too sometime
here is found some example but it's not dynamic Converting GMT time to local time using timezone offset in php
offset = '-0500';
$isDST = 1; // Daylight Saving 1 - on, 0 - off
$timezoneName = timezone_name_from_abbr('', intval($offset, 10) * 36, $isDST);
$timezone = new DateTimeZone($timezoneName);
Then you can use it in a DateTime constructor, e.g.
$datetime = new DateTime('2012-04-21 01:13:30', $timezone);
Now what exactly i am looking,
1- in case of TOM $date should be 18 11:38 PM Tuesday, 18 April 2017 (GMT-5) Time in Chicago, IL, USA
2- in case of jenne $date should be 19 9:40 AM Wednesday, 19 April 2017 (GMT+5) Time in Lahore