How I can create a new date with different timezone? I have tested many ways, but doesn't work, example
$date = new DateTimeZone('UTC+5');
My goal is to create the $date, then convert it to "UTC-5" format.
How I can create a new date with different timezone? I have tested many ways, but doesn't work, example
$date = new DateTimeZone('UTC+5');
My goal is to create the $date, then convert it to "UTC-5" format.
UTC+5 is not a timezone, it's an offset. A location on earth, say, New York, America, has a local time which is x hours different from the UTC standard time. That's the offset, like UTC-5. However, this offset changes throughout the year based on daylight saving time. In winter the offset may be -5, but in summer -6. A timezone is something which describes this clearly, it's a ruleset for what offset the local time is to UTC and when that offset changes. A timezone is specific to a location and is called, for example, America/New_York
.
Therefore, working with "UTC-5" offsets is pretty meaningless, and what you really want to do is use a timezone for the location you're working with.