DateTime modify function not respect Time Zone
Open
@derickr is already working on this.
Since Jul 1, 2024.
Bug
Extension: date
Status: Verified
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
The following code:
<?php
var_dump((new DateTime())->modify("2024-06-21T13:03:20-04:00"));
Resulted in this output(php >=8.2.5; >=8.3.0):
object(DateTime)#1 (3) {
["date"]=>
string(26) "2024-06-21 13:03:20.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
But I expected this output instead(this works on php 8.2.4, 8.2.3, 8.2.2):
object(DateTime)#1 (3) {
["date"]=>
string(26) "2024-06-21 13:03:20.000000"
["timezone_type"]=>
int(1)
["timezone"]=>
string(6) "-04:00"
}
PHP Version
=8.2.5; >=8.3.0;
Operating System
Any Linux or Windows
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.