配置单元中的时间戳差异(以字符串形式)

cuxqih21  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(350)

如何区分时间戳(在 string )在 hive 里?
我试过用

  1. date_format(column_name,'yyyy-MM-dd HH:mm:ss.sss')

转换成 timestamp 但不同的是给了我一个 null 价值

jc3wubiy

jc3wubiy1#

尝试使用unix\u时间戳函数

  1. select unix_timestamp('2018-03-03 00:08:48.409') - unix_timestamp('2018-03-02 00:08:48.409');
  2. +--------+--+
  3. | _c0 |
  4. +--------+--+
  5. | 86400 |
  6. +--------+--+

你的问题应该是

  1. select (unix_timestamp(step_start_time) - unix_timestamp(step_end_time ))diff;

相关问题