How to get the milliseconds from now() in Julia 0.4-pre?

孤街醉人 提交于 2019-12-13 13:13:19

问题


How to get the milliseconds from now()?

Dates.format(now(), "HH:MM:SS.sss")

gives

"18:32:11.000"

where the .sss part is always .000.


回答1:


now() does't record milliseconds:

julia> @show x=now(); @show Dates.millisecond(x); @show Dates.second(x)
x = now() = 2015-09-04T19:09:32
Dates.millisecond(x) = 0
Dates.second(x) = 32
32



回答2:


From your other question I found your comment:

dt = Dates.unix2datetime(time())
Dates.millisecond(dt)

Which does the business. Cheers.



来源:https://stackoverflow.com/questions/32407509/how-to-get-the-milliseconds-from-now-in-julia-0-4-pre

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!