I'm using Java Instant for my use-case where I want to capture the exact moment in timeline for.eg, { When the user last visited my website }. This is when the data gets persisted in the backend (sql). It persists in UTC format as I use Instant.now();
As my website is used across all Zones (In the world), When the user lands on the homepage, I want to show the dateTime (when he last visited the website) as localDateTime as per his zoneId.
How do I get the ZoneId Information?
As my website is currently hosted in 2 servers and both servers are in India, If I do ZoneId.systemDefault()
, I always get Indian ZoneId (Asia/Kolkota). So, the conversion is not possible.
If Someone from US hit's my server, How do I get the zoneId as US in my server?