From 349ff301c8a05ad574f428be7d8db1f912fc1fcd Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Wed, 29 Mar 2023 06:43:27 +0530 Subject: [PATCH] Use Dates.format in `yearmon` --- src/other/date_to_int.jl | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/other/date_to_int.jl b/src/other/date_to_int.jl index 67883cb..72d79ff 100644 --- a/src/other/date_to_int.jl +++ b/src/other/date_to_int.jl @@ -5,12 +5,5 @@ timestamps = yearmon.(dates) ``` """ function yearmon(x) - function two_digit_month(x) - if length(string(month(x))) == 1 - return "0" * string(month(x)) - else - return string(month(x)) - end - end - parse(Int, string(year(x)) * two_digit_month(x)) -end \ No newline at end of file + Dates.format(x, Dates.dateformat"YYYYmm") +end