I am calling my rest
api with following url localhost:8080/api/2016-05-30T10:30:00-05:00/3
The api receives date
as String
and then convert it into jodatime datetime object like dateTime = DateTime.parse(date);
... debugging this code shows that its resulting in expected value.
However, when i am converting this date to java.sql.timestamp
like Timestamp ts = new Timestamp(dateTime.getMillis());
... the resulting time is 2016-05-30 11:30:00.0
... why is it adding +1 hour
to the time and whats the proper way to convert ?
SOME BACKGROUND
I have saved the time as timestamp in sql table. with timezone (as a string +4:00 or -5:00 for example) in a separate column.
I would receive an ISO8601
time in my url path parameter and based on that I have to fetch the record from db. For that, I will be using two comparison. 1 to match the time and 2 to match the timezone.