DateTime + Hours

I thought this would be easy but I can’t do it.
I have a point of time in a day, say 9:15. I want to add time to this like 1.5
How do I do that?

julia> using Base.Dates

julia> t = Time(9, 15)
09:15:00

julia> t + Hour(1) + Minute(30)
10:45:10
1 Like

Why the 10 extra seconds?

IDK, didn’t even notice :man_shrugging:

Extremely weird. I can’t reproduce it:

julia> Time(9,15) + Hour(1) + Minute(30)
10:45:00

julia> versioninfo()
Julia Version 0.6.2
Commit d386e40c17 (2017-12-13 18:08 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-3920XM CPU @ 2.90GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, ivybridge)

Same here, I guess copy-paste on my computer is borked.

2 Likes
v0.6.2> Base.DateTime(2018,6,5,9, 15,0)+Dates.Hour(1) + Dates.Minute(30)
2018-06-05T10:45:00

v0.6.2>