Reputation: 69
I have a function that accepts 2 set of dates (start date
, and end date
) that will be used for my match engine
I have to know if the start_date1
& end_date1
is inside start_date2
& end_date2
Fast forward : I already have the right computation and implementation when I run it in local.. But when I run it in cloud.. This is the result
Result:
(DATETIME IN SQL)
input > **start_date1** : Apr 1, 2016 6:00am
input > **end_date1** : Apr 1, 2016 7:00pm
--
(TIMESTAMP IN SQL)
input > **start_date2** : Apr 1, 2016 6:00am
input > **end_date2** : Apr 1, 2016 6:00pm
output : true
--------------
As you can see the output must be false.. I think it is being adjusted by the DST.. Please tell me if there is a way to disregard DST or turn it off or the easiest way to disregard it..
BTW, I'm using Java 7.. Thanks!
Upvotes: 0
Views: 102
Reputation: 74
It can happen if your local and cloud time zone are different. Make sure that the two time zone are the same.
You can change your time zone with this command :
TimeZone.setDefault(TimeZone.getTimeZone("yourTimeZone"));
You can also choose time zone whithout DST, like "UTC" :
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
Upvotes: 1