Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

eggplantSword's avatar

Difference between created_at and dateTime in front

I'm trying to format dates but for some reason two dates show up as a different time. I must be because of timezones but I'm not sure how to check.

These two dates are the same but display differently

julio 17, 2023 11:30 AM  ->	2023-07-17 17:30:36 // this is correct to my local time
julio 17, 2023 5:30 PM  ->  2023-07-17 17:30:36 // this is not

I'm using dayjs to format this as follows

return dayjs(date).format('MMMM DD, YYYY h:mm A');

This is my timezone according to my config 'timezone' => 'UTC'

Why are the dates doing that? How can I make sure to display the correct time always?

0 likes
1 reply

Please or to participate in this conversation.