How to ceiling all Array{DateTime,1} ? ceil.(stopISO,Dates.Minute) not work


#1

julia> typeof(stopISO)
Array{DateTime,1}

julia> size(stopISO)
(66092,)
How to ceiling all Array{DateTime,1} ? ceil.(stopISO,Dates.Minute) not work.

julia> eltype(stopISO)
DateTime

julia> ceil(stopISO[1],Dates.Minute)
2016-04-01T04:47:00

julia> ceil.(stopISO,Dates.Minute)
ERROR: MethodError: no method matching size(::Type{Base.Dates.Minute
Closest candidates are:
size{N}(::Any, ::Integer, ::Integer, ::Integer…) at abstractarra
size(::BitArray{1}) at bitarray.jl:39
size(::BitArray{1}, ::Any) at bitarray.jl:43

in broadcast_shape(::Array{DateTime,1}, ::Type{T}) at .\broadcast.j
in broadcast_t(::Function, ::Type{Any}, ::Array{DateTime,1}, ::Vara
in broadcast(::Function, ::Array{DateTime,1}, ::Type{T}) at .\broad


#2

Perhaps this is what you want?

julia> a = Dates.DateTime(2017,11,18):Dates.Second(29):Dates.DateTime(2017,11,19)
2017-11-18T00:00:00:29 seconds:2017-11-18T23:59:51

julia> collect(a)
2980-element Array{DateTime,1}:
 2017-11-18T00:00:00
 ⋮                  
 2017-11-18T23:59:22
 2017-11-18T23:59:51

julia> ceil.(collect(a), Dates.Minute(1))
2980-element Array{DateTime,1}:
 2017-11-18T00:00:00
 ⋮                  
 2017-11-18T23:58:00
 2017-11-18T23:59:00
 2017-11-18T23:59:00
 2017-11-19T00:00:00
 2017-11-19T00:00:00

#3

On Julia 5.0 not works… Do you try it on Julia 6.0 ?
Paul


#4

Time to upgrade? V0.7 is just around the corner… :grinning: