From 16eaf38f00bc601c4874b1f48d13c920a240a831 Mon Sep 17 00:00:00 2001 From: imreddyTeja Date: Mon, 16 Dec 2024 11:21:44 -0800 Subject: [PATCH] Remove `yyyymmdd_to_datetime` function The functionality of the `yyyymmdd_to_datetime` function is already contained in the Dates package. --- ext/nc_common.jl | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/ext/nc_common.jl b/ext/nc_common.jl index bd698b51..b3314907 100644 --- a/ext/nc_common.jl +++ b/ext/nc_common.jl @@ -14,25 +14,8 @@ function read_available_dates(ds::NetCDFDataset) reinterpret.(Ref(NCDatasets.DateTimeStandard), ds["time"][:]) ) elseif "date" in keys(ds.dim) - return yyyymmdd_to_datetime.(string.(ds["date"][:])) + return Dates.DateTime.(string.(ds["date"][:]), Ref("yyyymmdd")) else return Dates.DateTime[] end end - -""" - strdate_to_datetime(strdate::String) - -Convert from String ("YYYYMMDD") to Date format. - -# Arguments -- `yyyymmdd`: [String] to be converted to Date type -""" -function yyyymmdd_to_datetime(strdate::String) - length(strdate) == 8 || error("$strdate does not have the YYYYMMDD format") - return Dates.DateTime( - parse(Int, strdate[1:4]), - parse(Int, strdate[5:6]), - parse(Int, strdate[7:8]), - ) -end