PostgreSQL 时间戳转毫秒值并去除小数位
PostgreSQL 大约 447 字时间戳转毫秒值
使用extract
函数及epoch from
关键词。
select extract(epoch from (current_timestamp)) * 1000
输出
z-blog=# select extract(epoch from (current_timestamp)) * 1000;
?column?
-------------------
1613011422272.017
(1 行记录)
去除小数位
使用trunc
函数去除小数位(直接去除小数点后面几位,不做四舍五入处理)。
select trunc(extract(epoch from (current_timestamp)) * 1000);
输出
z-blog=# select trunc(extract(epoch from (current_timestamp)) * 1000);
trunc
---------------
1613011444878
(1 行记录)
阅读 5395 · 发布于 2021-05-16
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
Android 仿 QQ 消息提示可拖拽控件 DragBadgeView阅读 2792
-
Nginx 日志按天生成阅读 9038
-
VMware Workstation 与 Hyper-V不 兼容阅读 4062
-
PHP 时间加减阅读 2250
-
GitHub 访问慢解决方案阅读 2498
-
IE localStorage Unable to get property 'setItem' of undefined or null reference阅读 837
-
Linux sort 命令简单使用阅读 2359
-
软考-系统架构设计师:Flynn 分类法阅读 2835
-
Linux 恢复删除的文件阅读 5286
-
Go 设置镜像阅读 3139