Ferenc
Ferenc

Reputation: 874

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

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.

Upvotes: 6

Views: 1450

Answers (2)

JobJob
JobJob

Reputation: 4137

From your other question I found your comment:

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

Which does the business. Cheers.

Upvotes: 0

IainDunning
IainDunning

Reputation: 11664

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

Upvotes: 4

Related Questions