From docs :
The Date module provides two types for working with dates: Date and DateTime , representing the day and millisecond precision , respectively;
(in italics).
So, rather than rounding, a DateTime throws an InexactError when parsing a timestamp with more than three decimal places. Limiting to three decimal places works:
julia> t = "2016-06-22T14:04:22.6615594Z" "2016-06-22T14:04:22.6615594Z" julia> DateTime(t,"ym-dTH:M:S.sZ") ERROR: InexactError() in slotparse at dates/io.jl:131 in getslot at dates/io.jl:143 in parse at dates/io.jl:158 julia> t2 = "2016-06-22T14:04:22.662Z" "2016-06-22T14:04:22.662Z" julia> DateTime(t2,"ym-dTH:M:S.sZ") 2016-06-22T14:04:22.662
More succinctly, DateTime cannot handle shares of a Millisecond :
julia> Base.Dates.Millisecond(111) 111 milliseconds julia> Base.Dates.Millisecond(111.1) ERROR: InexactError() in call at dates/types.jl:18
Chris source share