I'm using Carbon in Laravel to do some work on dates. I quickly realized that my local copy of PHP was set for UTC, so in my code I'm setting the timezone in Carbon:
$dt = Carbon::now('America/New_York');
Strangely, it's still spitting out a date that is one hour behind New York time:
echo $dt;
Yields:
2017-07-25 16:29:37
But it is currently 5:29pm
It seems as though it's an hour off because it's not factoring in daylight savings time. I can't find anything on StackOverflow or Google related to daylight savings time in Carbon, everything I read just says if you set the timezone correctly, it will account for DST on its own.
datetime
in yourphp.ini
file and check this answer – Amr Alyecho date("Y-m-d h:i:sa");
and see if you get the correct time according to your timezone – Amr Alylaravel/config/app.php
line ~ 67 ->'timezone' => __
– Antonios Tsimourtos