How to get the current time as 13-digit integer in Ruby?

后端 未结 7 484
闹比i
闹比i 2020-12-04 11:35

I have this jQuery function that returns the current time as the number of milliseconds since the epoch (Jan 1, 1970):

time = new Date().getTime         


        
7条回答
  •  甜味超标
    2020-12-04 12:32

    The typecast Integer(1e6*Time.now.to_f) returns a Bignum that can hold the milliseconds

提交回复
热议问题