-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
createFromTimestamp does not respect the default timezone #2966
Comments
All >= 3.0.0 are affected |
Hello, This is an expected breaking change. As timestamp is by nature UTC (it's the number of seconds since January 1st 1970 00:00 UTC), that's the reason why date_default_timezone_set('America/New_York');
$d = new DateTime('@1710358665');
var_dump($d->format('c')); Carbon 2 was incorrectly using But you can still use it explicitly: As a second note, I strongly recommend you always set default timezone to UTC and work with user/context timezone locally instead of globally. |
Then PHPdoc should be fixed too at least:
and I would expect it to be documented somewhere as a breaking change and what's the purpose of |
I will change the documentation. This is indeed incorrect. |
Hello,
I encountered an issue with the following code:
Carbon version: 3.1.1
PHP version: 8.3.4
I expected to get:
But I actually get:
Thanks!
The text was updated successfully, but these errors were encountered: