Skip to content

InexactError when dividing or multiplying Dates.Millisecond #15322

@IanButterworth

Description

@IanButterworth

Normal behaviour with second precision:

x_min = DateTime("2016-02-22T16:14:39")
x_max = DateTime("2016-02-22T20:23:51")
x_span = x_max-x_min
println(x_span)
y = x_span/20.0
println(y)

14952000 milliseconds
747600 milliseconds

Behaviour if date times have sub-second precision:

x_min = DateTime("2016-02-22T15:38:45.234")
x_max = DateTime("2016-02-22T19:27:35.363")
x_span = x_max-x_min
println(x_span)
y = x_span/20.0
println(y)

13730129 milliseconds
LoadError: InexactError()
while loading In[51], in expression starting on line 7

in / at dates/periods.jl:49

Metadata

Metadata

Assignees

No one assigned

    Labels

    datesDates, times, and the Dates stdlib moduledocsThis change adds or pertains to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions