@rafael.guerra I like this one! Nice that you can easily get millisecond precision with DateTime.(t)
, or preserve microsecond precision with Date.(t)
and Time.(t)
. So the full solution becomes:
using Dates, CompoundPeriods
T = [ 2017 09 06 00 00 04.911360;
2017 09 06 04 15 55.193727;
2017 09 06 22 55 12.256655]
tcp = Year.(T[:,1]) + Month.(T[:,2]) + Day.(T[:,3]) + Hour.(T[:,4]) +
+ Minute.(T[:,5]) + Nanosecond.(round.(Int,1e9*T[:,6]))
t = canonical.(tcp)
sdt = DateTime.(t) # millisecond precision
sdate = Date.(t) # date only
stime = Time.(t) # time only with microsecond precision