Answer the question
In order to leave comments, you need to log in
How to display dates and times with respect to timezones?
There is an array of strings with dates in the format 2017-02-09T00:20:00+05:00
when using date or datetime, it displays the time excluding +05:00, tell me how to be
Answer the question
In order to leave comments, you need to log in
$date = new DateTime('2017-02-09T00:20:00+05:00');
var_dump($date);
object(DateTime)[367]
public 'date' => string '2017-02-09 00:20:00.000000' (length=26)
public 'timezone_type' => int 1
public 'timezone' => string '+05:00' (length=6)
$date->setTimezone(new DateTimeZone('Europe/Moscow'));
var_dump($date);
object(DateTime)[367]
public 'date' => string '2017-02-08 22:20:00.000000' (length=26)
public 'timezone_type' => int 3
public 'timezone' => string 'Europe/Moscow' (length=13)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question