首页 > 其他 > 详细

字符串和时间

时间:2020-07-16 17:53:12      阅读:34      评论:0      收藏:0      [点我收藏+]

一、unix_timestamp 函数用法
1、unix_timestamp() 返回当前时间戳。另外,current_timestamp() 也有同样作用。

select unix_timestamp()  #输出:1530230400

2、unix_timestamp(string date) 返回 date 对应的时间戳,date 格式必须为 yyyy-MM-dd HH:mm:ss。

select unix_timestamp(2018-06-29 00:00:00);


3、unix_timestamp(string date, string format) 返回 date 对应的时间戳,date 格式由 format 指定。

 select unix_timestamp(2018/06/29 09, yyyy/MM/dd HH);

二、from_unixtime 函数用法

1、from_unixtime(int/bigint timestamp) 返回 timestamp 时间戳对应的日期,格式为 yyyy-MM-dd HH:mm:ss。

 select from_unixtime(1000000000);  //输出:2001-09-09 09:46:40

 

2、from_unixtime(int/bigint timestamp, string format) 返回 timestamp 时间戳对应的日期,格式由 format 指定。

select from_unixtime(1000000000, yyyy/MM/dd HH);

原文链接:https://blog.csdn.net/HappyRocking/java/article/details/80854778

字符串和时间

原文:https://www.cnblogs.com/muyue123/p/13323467.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!