0

When I create a DateTime using 'Etc/GMT+1' I get a different time than when I use 'GMT+1'. Shouldn't they be the same?

$etcGmt1 = new DateTime('now', new DateTimeZone('Etc/GMT+1'));
print_r($etcGmt1);

$gmt1 = new DateTime('now', new DateTimeZone('GMT+1'));
print_r($gmt1);

Results:

DateTime Object
(
    [date] => 2022-04-18 16:30:54.459987
    [timezone_type] => 3
    [timezone] => Etc/GMT+1
)
DateTime Object
(
    [date] => 2022-04-18 18:30:54.460006
    [timezone_type] => 1
    [timezone] => +01:00
)
joels
  • 6,773
  • 11
  • 50
  • 85
  • From the duplicate: "The Etc/GMT… names carry the opposite plus/minus convention: Etc/GMT+1 = -01:00 offset = One hour behind UTC" – Quentin Apr 18 '22 at 17:42

0 Answers0