hive中日期与时间戳转换
来源:互联网 发布:淘宝怎么搜索同城店铺 编辑:程序博客网 时间:2024/05/21 16:58
从1970-01-01 00:00:00 UTC到指定时间的秒数。
总结:时间戳到日期时间,日期时间到时间戳,日期时间到日期。
获取时间戳:select distinct unix_timestamp() from test_date;
时间戳>>>>日期:select distinct from_unixtime(1441565203,'yyyy/MM/dd HH:mm:ss') from test_date;
2015/09/07 02:46:43
日期时间>>>>>>时间戳:默认格式为“yyyy-MM-dd HH:mm:ss“:
select distinct unix_timestamp('2015-09-07 02:46:43') from test_date;
1441565203
指定日期时间>>>>>>时间戳:
select distinct unix_timestamp('20111207 13:01:03','yyyyMMdd HH:mm:ss') from test_date;
1323234063
//要接受的类型
日期时间>>>>>>日期:
select distinct to_date('2011-12-08 10:03:01') from test_date;
结果:2011-12-08
日期时间>>>>>>年/月/日/时/分/秒: year(string date),month(),day(),hour(),minute(),second()。
select distinct year('2011-12-08 10:03:01') from test_date;
2011
select distinct second('2011-12-08 10:03:01') from test_date;
1
总结:时间戳到日期时间,日期时间到时间戳,日期时间到日期。
获取时间戳:select distinct unix_timestamp() from test_date;
时间戳>>>>日期:select distinct from_unixtime(1441565203,'yyyy/MM/dd HH:mm:ss') from test_date;
2015/09/07 02:46:43
日期时间>>>>>>时间戳:默认格式为“yyyy-MM-dd HH:mm:ss“:
select distinct unix_timestamp('2015-09-07 02:46:43') from test_date;
1441565203
指定日期时间>>>>>>时间戳:
select distinct unix_timestamp('20111207 13:01:03','yyyyMMdd HH:mm:ss') from test_date;
1323234063
//要接受的类型
日期时间>>>>>>日期:
select distinct to_date('2011-12-08 10:03:01') from test_date;
结果:2011-12-08
日期时间>>>>>>年/月/日/时/分/秒: year(string date),month(),day(),hour(),minute(),second()。
select distinct year('2011-12-08 10:03:01') from test_date;
2011
select distinct second('2011-12-08 10:03:01') from test_date;
1
0 0
- hive中日期与时间戳转换
- Hive中日期与时间戳的转换
- oracle中日期类型与unix 时间戳的转换
- oracle中日期类型与unix 时间戳的转换
- oracle中日期类型与unix 时间戳的转换
- oracle中日期类型与unix 时间戳的转换
- oracle中日期类型与unix 时间戳的转换
- oracle中日期类型与unix 时间戳的转换
- oracle中日期类型与unix 时间戳的转换
- java中日期时间格式与毫秒数的转换
- Hive中日期格式转换用法
- mysql 中日期格式 与 时间戳之间的相互转换
- 关于项目中日期时间与时间戳转化
- sql server中日期时间格式转换
- MySQL中日期和时间格式转换
- Android中日期时间格式转换
- Hive中日期处理
- C#中日期与时间的格式
- php常用函数
- 如何在代码中跑Linux指令
- JQuery url长度太长,导致报错
- Linux设备模型(7)_Class
- H5移动应用的发布优化(四)图片优化
- hive中日期与时间戳转换
- JFreeChart学习(三)——动态打印java内存使用情况
- 放大分析双缓冲类时间计算问题
- jvisualvm远程监控 visualgc插件 不受此jvm支持
- spring mvc 如何传递集合参数(list,数组)
- 吃糖果
- 最后一本书 第六章课后练习3,4
- 用Hive+Hadoop集群实现《飞机票购买人群分类案例》思路+代码 (实验数据待整理)
- zoj-【2857 Image Transformation 】