Second, I think that try ... catch is not recommended for use like this because it may be slow. It would be better to just test the string for :. Eg something like
using Dates
function robust_time_parse(str)
if any(isequal(':'), str)
Time(str, dateformat"HH:MM:SS")
else
Time(str, dateformat"HHMMSS")
end
end
robust_time_parse("090101")
robust_time_parse("09:01:01")
Thank you, but there maybe some other cases, like HHMM, HHMMSS. milisecond, or any other format.
Ideally i want to have a generic solution, just like in C#, that I can do “xxx|yyy|zzz”.
Where Can I request such a feature to Julia developer?