Hi all
I want to parse the following datetime string but can’t find the right format.
julia> using Dates
julia> format = dateformat"y-m-dTH:M:S.s"
dateformat"y-m-dTH:M:S.s"
julia> dt_str = "2021-05-26T21:00:19.1816626Z"
"2021-05-26T21:00:19.1816626Z"
julia> DateTime(dt_str, format)
ERROR: InexactError: convert(Dates.Decimal3, 1816626)
Stacktrace:
[1] tryparsenext
@ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Dates\src\io.jl:153 [inlined]
[2] tryparsenext
@ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Dates\src\io.jl:41 [inlined]
[3] macro expansion
@ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Dates\src\parse.jl:64 [inlined]
[4] tryparsenext_core(str::String, pos::Int64, len::Int64, df::DateFormat{Symbol("y-m-dTH:M:S.s"), Tuple{Dates.DatePart{'y'}, Dates.Delim{Char, 1}, Dates.DatePart{'m'}, Dates.Delim{Char, 1}, Dates.DatePart{'d'}, Dates.Delim{Char, 1}, Dates.DatePart{'H'}, Dates.Delim{Char, 1}, Dates.DatePart{'M'}, Dates.Delim{Char, 1}, Dates.DatePart{'S'}, Dates.Delim{Char, 1}, Dates.DatePart{'s'}}}, raise::Bool)
@ Dates C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Dates\src\parse.jl:38
[5] macro expansion
@ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Dates\src\parse.jl:150 [inlined]
[6] tryparsenext_internal
@ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Dates\src\parse.jl:125 [inlined]
[7] parse(::Type{DateTime}, str::String, df::DateFormat{Symbol("y-m-dTH:M:S.s"), Tuple{Dates.DatePart{'y'}, Dates.Delim{Char, 1}, Dates.DatePart{'m'}, Dates.Delim{Char, 1}, Dates.DatePart{'d'}, Dates.Delim{Char, 1}, Dates.DatePart{'H'}, Dates.Delim{Char, 1}, Dates.DatePart{'M'}, Dates.Delim{Char, 1}, Dates.DatePart{'S'}, Dates.Delim{Char, 1}, Dates.DatePart{'s'}}})
@ Dates C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Dates\src\parse.jl:282
[8] DateTime(dt::String, df::DateFormat{Symbol("y-m-dTH:M:S.s"), Tuple{Dates.DatePart{'y'}, Dates.Delim{Char, 1}, Dates.DatePart{'m'}, Dates.Delim{Char, 1}, Dates.DatePart{'d'}, Dates.Delim{Char, 1}, Dates.DatePart{'H'}, Dates.Delim{Char, 1}, Dates.DatePart{'M'}, Dates.Delim{Char, 1}, Dates.DatePart{'S'}, Dates.Delim{Char, 1}, Dates.DatePart{'s'}}})
@ Dates C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Dates\src\io.jl:483
[9] top-level scope
@ REPL[4]:1
I know that Julias DateTime
isn’t that accurate. But it’s good enough for me.