How to retrieve microseconds or milliseconds from MySQL current time?

前端 未结 5 2148
天涯浪人
天涯浪人 2021-01-02 02:17

I am trying to create my first stored function on MySQL. In this function I want to return the timestamp of the current date and time with 3 microsecond digits like this:

5条回答
  •  暖寄归人
    2021-01-02 02:39

    For mysql 5.6

    round(unix_timestamp() * 1000  + MICROSECOND(sysdate(6)) / 1000)
    

提交回复
热议问题