Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The conversion method of date format in hive

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the conversion method of date format in hive". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the conversion method of date format in hive".

Conversion method of date format in hive:

The method of transforming 2014-11-10 and 20141110 into each other:

1.from_unixtime & & unix_timestamp

-- 20141110

Select from_unixtime (unix_timestamp ('2014-11-10mm yyyymmdd') from default.dual

-2014-11-10

Select from_unixtime (unix_timestamp ('20141110')), 'yyyy-mm-dd') from default.dual

2.substr + concat

-- 20141110

Select concat (substr ('2014-11-10)), substr (' 2014-11-10)), substr ('2014-11-10)) from default.dual

-2014-11-10

Select concat (substr ('20141110 gift record1),' -', substr ('20141110 magic mine5),' -', substr ('20141110)) from default.dual

Attach: hive gets the current time

Select from_unixtime (unix_timestamp (), 'yyyy-MM-dd HH:mm:ss') from default.dual

Thank you for your reading, the above is the content of "the conversion method of date format in hive". After the study of this article, I believe you have a deeper understanding of the conversion method of date format in hive, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report