# TimesDates.jl dev for v2

**URL:** <https://discourse.julialang.org/t/timesdates-jl-dev-for-v2/78377>\
**Category:** Specific Domains\
**Tags:** dates, time, internals\
**Created:** [March 24, 2022, 10:00am UTC](https://discourse.julialang.org/t/timesdates-jl-dev-for-v2/78377 "2022-03-24T10:00:08Z")\
**Posts on this page:** 1\
**Showing post:** 44

<div class="post-metadata">

**Author:** ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)\
**Post date:** [September 14, 2023, 3:03am UTC](https://discourse.julialang.org/t/timesdates-jl-dev-for-v2/78377/44 "2023-09-14T03:03:28Z")

</div>

The significance of milliseconds for the DateTime API has been debated recently on here and GitHub.

> <https://github.com/JuliaLang/julia/pull/50816>
>
> ~~Resolves #50785~~ EDIT: the PR changed over time, see the discussion
> 
> This i…s a proposal for fixing the linked issue. The PR consists of two commits. 
> 
> The first commit just adds a few tests and one sentence to the docs of \`DateTime\`. I think this could be merged.
> 
> The second commit changes addition/subtraction of a \`DateTime\` and \`Microsecond\`/\`Nanosecond\`. 
> Before:
> \`\`\`julia
> julia\> DateTime(2023, 08, 07) + Microsecond(1) # truncates
> 2023-08-07T00:00:00
> 
> julia\> DateTime(2023, 08, 07) + Nanosecond(1) # truncates
> 2023-08-07T00:00:00
> 
> julia\> DateTime(2023, 08, 07) + Microsecond(10^3)
> 2023-08-07T00:00:00.001
> 
> julia\> DateTime(2023, 08, 07) + Nanosecond(10^6)
> 2023-08-07T00:00:00.001
> \`\`\`
> After:
> \`\`\`julia
> julia\> DateTime(2023, 08, 07) + Microsecond(1) # throws
> ERROR: InexactError: +(Millisecond, 1 microsecond)
> 
> julia\> DateTime(2023, 08, 07) + Nanosecond(1) # throws
> ERROR: InexactError: +(Millisecond, 1 nanosecond)
> 
> julia\> DateTime(2023, 08, 07) + Microsecond(10^3)
> 2023-08-07T00:00:00.001
> 
> julia\> DateTime(2023, 08, 07) + Nanosecond(10^6)
> 2023-08-07T00:00:00.001
> \`\`\`
> The second commit is breaking so I am not sure if it can be merged.
> 
> cc @jariji

> [@\`DateTime\` arithmetic on \`Microsecond\` (or smaller) scale](https://discourse.julialang.org/t/datetime-arithmetic-on-microsecond-or-smaller-scale/102949):
>
> There is currently a [PR on the repo](https://github.com/JuliaLang/julia/pull/50816) with very lively discussion about what the following operation should do: using Dates a = now() b = a + Nanosecond(1) (the situation is analogous with Microsecond) Currently, the result is always exactly equal to a, because the DateTime arithmetic implemented in Dates simply truncates the non-DateTime argument to milliseconds (as that is the supported precision of DateTime), and whatever the result is, will be added to DateTime: julia\> using Dates julia\>…

---

_[View the full topic](https://discourse.julialang.org/t/timesdates-jl-dev-for-v2/78377)._
