hive : how to substract 1 second of a given timestamp -
i want subtract 1 second given timestamp in hive. when trying add 1 second given timestamp, working good, subtracting not working good.
the below statement giving me correct result addition
select from_unixtime(unix_timestamp('2016-11-06 01:00:00.000','yyyy-mm-dd hh:mm:ss.sss'),'yyyy-mm-dd hh:mm:ss.sss') , from_unixtime(unix_timestamp('2016-11-06 01:00:00.000','yyyy-mm-dd hh:mm:ss.sss') + 1,'yyyy-mm-dd hh:mm:ss.sss') but substraction not getting correct result using below
select from_unixtime(unix_timestamp('2016-11-06 01:00:00.000','yyyy-mm-dd hh:mm:ss.sss'),'yyyy-mm-dd hh:mm:ss.sss') , from_unixtime(unix_timestamp('2016-11-06 01:00:00.000','yyyy-mm-dd hh:mm:ss.sss') - 1,'yyyy-mm-dd hh:mm:ss.sss') the subtract result getting
2016-11-06 01:00:00.000 2016-11-06 01:59:59.000 but expected result
2016-11-06 01:00:00.000 2016-11-06 12:59:59.000
"usa & canada: dst ends on nov 6, 2016 ...
most of united states, canada, , mexico's northern border cities end daylight saving time (dst) on sunday, november 6, 2016.
dst ends on sun, nov 6, 2016clocks set 1 hour standard time 02:00 (2 am) 01:00 (1 am), local time."
https://www.timeanddate.com/news/time/usa-canada-end-dst-2016.html
Comments
Post a Comment