Finding an equality between two datetime

Hi,

a = [DateTime(“2021-08-02T10:00:00”), DateTime(“2021-08-05T07:00:00”), DateTime(“2021-08-05T07:00:00”)]

b = DateTime(“2021-08-05T07:00:00”)

for i in 1:length(a)
print(findall(b == a[i]))
end

Result : Int64Int64Int64Int64Int64

I am trying to find the positions in a where a==b (here position 3) but as you can see the result is not what I expected. Does anyone have any ideas ?
(I tried with occursin but it only works with stings)

Thank you,

Maybe like this:

julia> a = [DateTime("2021-08-02T10:00:00"),
            DateTime("2021-08-05T07:00:00"),
            DateTime("2021-08-05T07:00:00")];

julia> b =  DateTime("2021-08-05T07:00:00");

julia> findall(x -> x == b, a)
2-element Vector{Int64}:
 2
 3

Thanks !

You could also do a .== b to get a bit array, or to get the indices: eachindex(a)[a .== b]