# Parsing high precision timestamps?

**URL:** <https://discourse.julialang.org/t/parsing-high-precision-timestamps/44061>\
**Category:** General Usage\
**Tags:** dates, time\
**Created:** [July 31, 2020, 9:20pm UTC](https://discourse.julialang.org/t/parsing-high-precision-timestamps/44061 "2020-07-31T21:20:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![crbinz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crbinz/32/1919_2.png) [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Post date:** [July 31, 2020, 9:20pm UTC](https://discourse.julialang.org/t/parsing-high-precision-timestamps/44061/1 "2020-07-31T21:20:33Z")

</div>

I have a series of timestamps like 2020-01-01T12:34:56.789123Z. Trying to parse it with `DateTime("2020-01-01T12:34:56.789123Z", dateformat"Y-m-dTH:M:S.ssssssZ")` results in `ERROR: LoadError: InexactError: convert(Dates.Decimal3, 789123)`.

I found [TimesDates.jl](https://github.com/JeffreySarnoff/TimesDates.jl), and I can work around this issue with the following: `DateTime(TimeDate(timestr[1:end-1]))`, but that seems more brittle and also sort of silly. Is there a more canonical way to do this?

---

<div class="post-metadata">

**Author:** ![helgee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/helgee/32/2022_2.png) [@helgee](https://discourse.julialang.org/u/helgee)\
**Post date:** [August 1, 2020, 7:34am UTC](https://discourse.julialang.org/t/parsing-high-precision-timestamps/44061/2 "2020-08-01T07:34:22Z")

</div>

Since `Dates.DateTime` is limited to millisecond precision anyways, you could just do `DateTime(str[1:end-4])`.

The problem is though that this also affects `Dates.Time` which should supports micro- and nanosecond precision and also downstream packages like AstroTime.jl which rely on the parser in Dates.

EDIT: I have posted a link to this thread in this issue [https://github.com/JuliaLang/julia/issues/29339](https://github.com/JuliaLang/julia/issues/29339)

---

<div class="post-metadata">

**Author:** ![crbinz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crbinz/32/1919_2.png) [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Post date:** [August 1, 2020, 5:09pm UTC](https://discourse.julialang.org/t/parsing-high-precision-timestamps/44061/3 "2020-08-01T17:09:08Z")

</div>

> [@helgee](#):
>
> Since `Dates.DateTime` is limited to millisecond precision anyways, you could just do `DateTime(str[1:end-4])` .

Oh, right 😬

Thanks for the link to that issue, I’ll follow along there.
