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

sarmadindhar's avatar

Display date and time according to Logged in user's timezone

Hi all I have an application in which multiple users insert a record and a push notification is sent to other related users but these users have different timezone . My question is how can I display the record/notification creation time to every user according to his timezone. Currently I am using created_at column that displays the time only according to the timezone of user who created the record/notification.

0 likes
1 reply
tykus's avatar

It is most likely that the created_at timestamp is consistent (maybe UTC) based on the timezone specified in config/app.php.

You have two choices with regard to showing local time (i) calculate it on the server side based on a known timezone setting for the authenticated user, or (ii) get the local timezone in the user's browser using moment.js or vanilla JS Intl.DateTimeFormat().resolvedOptions().timeZone and convert the UTC time from the server

Please or to participate in this conversation.