DateTime + Hours


#1

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?


#2
julia> using Base.Dates

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

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

#3

Why the 10 extra seconds?


#4

IDK, didn’t even notice :man_shrugging:


#5

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)

#6

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


#7
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>