I have searched all the way that timestamp should be stored in UTC and I am doing the same. On server startup I am setting timezone to UTC.
I have user who have default time say IST, now my question is how Date should be stored in database.
For eg user is running a job in the month of 1st of Dec 01:30 AM and in database value should go as 12/01/2017 (mm/dd/yyyy), but one thing to notice here is UTC is still 30th Nov 2017 8:00 PM (IST = UTC+5.30).
Now if I get date using java
Date date = new Date();
I will get output as 30 Nov instead of 1st Dec, so every time I do
new Date();
I have to first convert Date from UTC to user default time zone and store in database.
Please note I am saving timestamp as it is in UTC timezone