从时间戳获取日期

编程入门 行业动态 更新时间:2024-10-27 16:36:14
本文介绍了从时间戳获取日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个这样的日期字段:2017-03-22 11:09:55(列名:install_date) 我还有另一个日期字段,其日期是这样的:2017-04-20(列名:test_date)

I have a date field like this: 2017-03-22 11:09:55 (column name: install_date) I have another date field with date like this: 2017-04-20 (column name: test_date)

我只想从上述(2017-03-22)中获取日期字段,以便可以在install_date和test_date之间执行DATEDIFF.

I would like to obtain only the date field from the above (2017-03-22) so that I can perform a DATEDIFF between install_date and test_date.

推荐答案

假设您正在Hive中寻找它,则可以使用TO_DATE函数.

Assuming you are looking for this in Hive, you can use TO_DATE function.

TO_DATE('2000-01-01 10:20:30') returns '2000-01-01'

NOTE:输入TO_DATE是一个字符串

NOTE: Input to TO_DATE is a string

更多推荐

从时间戳获取日期

本文发布于:2023-10-16 12:30:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1497559.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:日期   时间

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!