0

I have a unix timestamp for each cooment in my database. I want to output the user date and time depending on their location, or timezone.

How do I do that properly?

2
Contributors
3
Replies
13
Views
2 Weeks
Discussion Span
Last Post by rproffitt
0

Think about how users get to the Internet today. You can't count on their location being accurate since they could be using a VPN, Tor or another system. Fix? Just add their timezone to their user profile.

0

Yes, but I want to get their timezone even if they were using a VPN, or whatever. Is there an effeciant way?

1

If they are using a VPN you usually get the TZ of where they appear according to the VPN. There's nothing wrong about that which is why my view is to let them set the TZ in their profile.

But if you insist, then use this call: Intl.DateTimeFormat().resolvedOptions().timeZone

Edited by rproffitt: Fix link.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.