My server has 5 hours difference from my current location time. After I record an event I'd like to display current local time. My time is stored in db as DATETIME value (0000:00:00 00:00:00).
I can get offset time in seconds with PHP like this:
$offset = date('Z');
So, the time from db will be:
$time = '2016-03-31 01:40:13';
But if my time is offset by -18000 sec, i.e. -5 hrs, the display time should be
2016-03-30 20:40:13
So I've attempted:
echo date('Y:m:d H:i:s', mktime(strtotime($time + $offset)));
But it looks convoluted...