How to convert Eastern time zone to CENTRAL TIME zone

I have time that is in the Eastern time zone, but I want to set it to CENTRAL ZONE TIME. Both time zones are in the USA. I have never done this before? I do not know how to convert it. Please help me?

+3
source share
3 answers

This is one of the possible ways:

$dt = new DateTime('2011-02-22 16:15:20', new DateTimeZone('America/New_York'));
echo $dt->format('r') . PHP_EOL;

$dt->setTimezone(new DateTimeZone('America/Chicago'));
echo $dt->format('r') . PHP_EOL;

You can get a list of available time zones with:

print_r(DateTimeZone::listIdentifiers());
+11
source

1 . , .

+1

Source: https://habr.com/ru/post/1793891/


All Articles