The Epoch time is universal, no matter where you live, the epoch time shall remain the same.
In Java, you can use calendar, date and LocalDateTime to fetch the current time.
Will the Time in Millis for the date and time calculated by java be the same where ever you are on earth? Or will they differ based on the time zone, you are currently in?
The reason for this question being, my current application needs to process dates for different timezones in parallel. If I use a specific zone, the application results are not in sync wrt other time zones.
Any advice on how to solve this issue?
Eg: Say, A customer buys a product in US on 1'st Jan 2020, at 6:00 AM. In server's timezone, the date itself is different and this transaction doesn't get processed in Singapore time zone, for 2019, as the offset is over 18 hours. However, the transaction gets processed for the year 2018.
I see the following possible solutions. Any advice on how to proceed further?
-> Configure the timezone for MySQL connection, to ensure you always have the right date and time as per the transaction while processing. However, this might not function for Windows server.
-> Add the offset hours and minutes to the time, permanently, so, no further calculations are needed throughout the code.
-> Modify the whole code to use timezone everywhere and use the date, hours and minutes everywhere, to ensure you are processing the right transaction.