gpt4 book ai didi

hadoop - Hive - 以分钟为单位的时差为负

转载 作者:可可西里 更新时间:2023-11-01 15:55:52 25 4
gpt4 key购买 nike

我需要以分钟为单位获取时差,以便在 Hive 查询中进行分析。

我正在使用 unix_timestamp() 将日期转换为秒,然后减去以秒为单位的差异,然后乘以 60 以分钟为单位。

我的问题是我最近的约会 - 较早的日期差异变为负值。

这是我的查询和结果

Hive query and result screenshot

processed_ts create_ts processed_unix_timestamp create_unix_timestamp miniue Diff
2017-03-12 3:01:06 2017-03-12 2:58:36 1489312865 1489316315 -57.5
2017-03-12 3:01:36 2017-03-12 2:59:06 1489312895 1489316345 -57.5
2017-03-12 3:02:12 2017-03-12 2:59:42 1489312932 1489316382 -57.5

非常感谢任何帮助。

最佳答案

USA & Canada Start DST on March 12
Published 17-Feb-2017

Most of the United States, Canada, and Mexico's northern border citieswill begin Daylight Saving Time (DST) on Sunday, March 12, 2017.

People in areas that observe DST will spring forward 1 hour from 02:00(2 am) to 03:00 (3 am), local time.Standard time will resume onSunday, November 5, 2017.

https://www.timeanddate.com/news/time/usa-canada-start-dst-2017.html


select timestamp '2017-03-12 02:58:36'

2017-03-12 03:58:36

关于hadoop - Hive - 以分钟为单位的时差为负,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44379334/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com