I have an instance of Oracle DB running in 2 locations - US and Europe. The java app servers connected to these are also in different locations. Eg, DB in US is connected to java server in India and DB in Europe is connected to java server in Japan. My task is, to pick a date from database from US and send it via Kafka to Europe and vice versa.
The problem is, the time I send from first region will not match with the time in other region. I want that if I send "22-Aug-2022 12:00:00" from US, it should get converted into equivalent time in Europe that is "22-Aug-2022 06:00:00" (depends on DB time only, not app server time).
What I thought of this problem was that I would take the UTC time from one region, send it over and in the destination region, insert the equivalent time. But whatever I have tried is not working due to lack of experience. I am not able to get the correct UTC timestamp in java.
Can someone suggest the best approach for this problem which takes care of converting and fetching the timestamp at DB level.
Edit:-
PS: Please ignore the time conversion logic in the given example. It's just an example and may be it is not factually correct. Please provide suggestions on time conversion in a generic way