一. 日期>>>>时间戳

1.unix_timestamp()   获取当前时间戳
例如:select unix_timestamp()   --
2.unix_timestamp(string timestame)   输入的时间戳格式必须为'yyyy-MM-dd HH:mm:ss',如不符合则返回null
例如:
select unix_timestamp('2019-08-15 16:40:00') --
select unix_timestamp('2019-08-15') --null
3.unix_timestamp(string date,string pattern)   将指定时间字符串格式字符串转化成unix时间戳,如不符合则返回null
例如:
select unix_timestamp('2019-08-15','yyyy-MM-dd') -- select unix_timestamp('2019-08-15 16:40:00','yyyy-MM-dd HH:mm:ss') -- select unix_timestamp('2019-08-15','yyyy-MM-dd HH:mm:ss') --null
二. 时间戳>>>>日期

1.from_unixtime(bigint unixtime,string format)  将时间戳秒数转化为UTC时间,并用字符串表示,可通过format规定的时间格式,指定输出的时间格式,其中unixtime 是10位的时间戳值,而13位的所谓毫秒的是不可以的。
例如:
select from_unixtime(,'yyyy-MM-dd HH:mm:ss') ---- :: select from_unixtime(,'yyyy-MM-dd') ----
2.如果unixtime为13位的,需要先转成10位
select from_unixtime(cast(/ as int),'yyyy-MM-dd HH:mm:ss')   ---- ::

select from_unixtime(cast(substr(,,) as int),'yyyy-MM-dd HH:mm:ss')  ---- ::

 三.获取当前时间

select from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')   -- -- ::

最新文章

  1. 点(x3,y3)到经过点(x1,y1)和点(x2,y2)的直线的最短距离
  2. 前台JS(type=‘file’)读取本地文件的内容,兼容各种浏览器
  3. if条件里比较浮点数
  4. [转载] linux下打开windows txt文件中文乱码问题
  5. hdu1059 Dividing ——多重背包
  6. WordPress主题制作教程10:添加文章类型插件Custom Post Type UI
  7. 巧妙使用Jquery 改变元素的 onclick 事件
  8. make xxx Is a directory. Stop.
  9. java代码如何快速添加作者描述的注释最好能有详细的图解
  10. 贪吃蛇AI
  11. MySQL数据目录更改及相关问题解决方案
  12. Robot Framework学习笔记(十)------Selenium2Library库
  13. JAVA_SE基础——47.接口
  14. [BZOJ 4403]序列统计
  15. poj 2886 线段树+反素数
  16. Sql Server 查询库表记录数
  17. CertUtil.exe被利用来下载恶意软件
  18. shell中set的用法(转)
  19. EXCEPTION-SPRING
  20. 《OD大数据实战》Spark入门实例

热门文章

  1. Java实现 蓝桥杯 算法训练 数据交换
  2. Java实现分割矩形
  3. java实现拼出漂亮的表格
  4. Java实现格子取数问题
  5. Python 图像处理 OpenCV (7):图像平滑(滤波)处理
  6. npm run dev启动项目,electron提示throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
  7. CentOS8.1中搭建Gitlab服务器
  8. 轻量级进度条 – Nprogress.js
  9. FFT,NTT入门
  10. BrainF**k的编译器