Open cxen opened 1 month ago
The origin of your problem is Excel behaviour.
If you enter 65:08:06
Excel will convert this to a DateTime with 1900-1-1 as reference value.
Julia provides many ways of converting DateTime, in particular it can substract to return the time difference. I'm not sure what your column returns if you have values <24h and >24. If it is always of DateTime but with different offsets, then I'd go for something like
function myminutes(t::DateTime)
Minute(t - (t < DateTime(0, 1, 1) ? DateTime(0) : DateTime(1900))
end
If it is Time for t<24h and DateTime for t>24h then it's
function myminutes(t::DateTime)
Minute(t - DateTime(1900))
end
function myminutes(t::Time)
Minute(t)
end
If you need the value instead of the Minute
type, just append `.value``
myminutes(t).value
I have time data in this format 00:00:00. However, contrary to the expectations of XLSX.jl and Date.jl, my "Time" data is only measured in hours, so it will go to > 23:59:59, like 65:08:06. Unfortunately, the Time values over 24 h get converted to something like 1900-01-01T16:48:06.
I tried infer_eltypes true/false but it makes not difference.
Since I need time in minutes, I wrote a custom function to bypass this issue, but I am sure there must be a more elegant way to handle these time data.