<span class="text-blue-500 underline" title="Comment by {{ $comment->user->name }} at {{ CarbonCarbon::parse($comment->updated_at)->setTimezone('America/New_York')->format('M d, Y H:i A') }}">
{{ AppUtilitiesDateFormatter::formatDateAsPhrase($comment->updated_at) }}
</span>
This is the area in my PHP file that I’m trying to ensure is EST time. In my .env file the APP_TIMEZONE is set to America/New_York as well. Anytime I hover over the UTC is still being displayed even after forcing the setTimezone. The db (sqlite) stores as UTC but should be converting to EST anyway.
Tried hard coding (above), clearing cache (php artisan config:clear), config(app.timezone)
2
Answers
While using default column updated_at, Laravel is already returning you with a carbon object. So you just have to use
By using carbon object
use CarbonCarbon;
Carbon::parse($comment->updated_at)->tz(‘America/New_York’)->format(‘M d, Y H:i A’);