diff --git a/ecml_tools/data/misc.py b/ecml_tools/data/misc.py index 17b5f11..6f4a83a 100644 --- a/ecml_tools/data/misc.py +++ b/ecml_tools/data/misc.py @@ -97,6 +97,13 @@ def _as_date(d, dates, last): return np.datetime64(f"{year:04}-{month:02}-{day:02}T00:00:00") if isinstance(d, str): + + if "-" in d and ":" in d: + date, time = d.replace(" ", "T").split("T") + year, month, day = date.split("-") + hour, minute, second = time.split(":") + return np.datetime64(f"{year:04}-{month:02}-{day:02}T{hour}:{minute}:{second}") + if "-" in d: assert ":" not in d bits = d.split("-")