【问题标题】:i want to convert into epoch(i.e) milliseconds我想转换成纪元(即)毫秒
【发布时间】:2013-06-11 19:28:59
【问题描述】:

但是我想转换成毫秒,我的时间戳在postgres sql中是这样的

2013-05-14 14:03:28.675126

谁能告诉我可以转换的查询

2013-05-14 14:03:28 

这部分在http://www.epochconverter.com/

我的查询是这样的

SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 1315310331000/1000 * INTERVAL '1 second

但在 .675126 之后我也想知道该值。

【问题讨论】:

    标签: postgresql wso2 wso2esb wso2dss


    【解决方案1】:

    这就是你所追求的吗?

    => SELECT extract(epoch from now()) + 1315310331000/1000;
         ?column?     
    ------------------
     2686258457.90003
    (1 row)
    

    【讨论】:

    • 在我的 postgres sql 中数据类型是没有时区的时间戳是这样的 2013-05-14 14:03:28.675126 我想转换成纪元格式,你能告诉我吗?
    • 如果以上都行不通,那我怕是没看懂问题。
    • 我的查询是这样的 select branchId,branchCode,branchName,branchDataType,branchDataSize,uomid as branchUOMId,mbranch.status as branchStatus from mbranchwhere clientid=-1 and modifiedon=(SELECT TIMESTAMP WITH TIME ZONE 'epoch ' + 1331663400000/1000 * 间隔 '1 秒')
    【解决方案2】:

    不要分开。乘以毫秒

    select timestamp with time zone 'epoch' + 1315310331341 * interval '1 milliseconds';
              ?column?          
    ----------------------------
     2011-09-06 08:58:51.341-03
    

    【讨论】:

    • 我的时间戳是这样的 2013-05-14 14:03:28.675126 如何转换成epoch或者long
    猜你喜欢
    • 2015-07-07
    • 2013-11-11
    • 2012-03-08
    • 1970-01-01
    • 2020-05-05
    • 2020-01-11
    • 1970-01-01
    • 2012-02-19
    • 2017-10-09
    相关资源
    最近更新 更多