oracle systimestamp (sysdate) to milliseconds

前端 未结 7 1247
予麋鹿
予麋鹿 2020-12-16 14:15

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

select current_tim         


        
相关标签:
7条回答
  • 2020-12-16 15:14

    The best thing I know of is:

    select extract(day    from (systimestamp - timestamp '1970-01-01 00:00:00')) * 86400000
         + extract(hour   from (systimestamp - timestamp '1970-01-01 00:00:00')) * 3600000
         + extract(minute from (systimestamp - timestamp '1970-01-01 00:00:00')) * 60000
         + extract(second from (systimestamp - timestamp '1970-01-01 00:00:00')) * 1000 unix_time
    from dual;
    

    I'm not quite sure what requirements you have regarding time zone. You might need to make minor adjustments for that.

    0 讨论(0)
提交回复
热议问题