oracle systimestamp(sysdate)到毫秒 [英] oracle systimestamp (sysdate) to milliseconds

查看:2247
本文介绍了oracle systimestamp(sysdate)到毫秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以提供存储函数的实现,以毫秒为单位获取当前 systimestamp

我可以使用像

Could you provide implementation of stored function to get current systimestamp as milliseconds.
Something I can use like

select current_time_ms from dual;

并获取当前时间和1970年1月1日午夜之间的差值

and get the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

谢谢。

推荐答案


  • DB时区无关

  • 以毫秒

  • 在XE中工作

  • 
        function current_time_ms
            return number
        is
            out_result number;
        begin
            select extract(day from(sys_extract_utc(systimestamp) - to_timestamp('1970-01-01', 'YYYY-MM-DD'))) * 86400000 
                + to_number(to_char(sys_extract_utc(systimestamp), 'SSSSSFF3'))
            into out_result
            from dual;
            return out_result;
        end current_time_ms;
    

    这篇关于oracle systimestamp(sysdate)到毫秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆