From 1686c41b5e9b35ffae6dfa8769423421e7016e6a Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 21 Jul 2021 15:51:32 +0800 Subject: [PATCH] bugfix --- appPublic/timeUtils.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/appPublic/timeUtils.py b/appPublic/timeUtils.py index d02babe..5aa5cb3 100644 --- a/appPublic/timeUtils.py +++ b/appPublic/timeUtils.py @@ -159,3 +159,28 @@ def timestampSub(ts1,ts2) : def timestamp2dt(t): return datetime.datetime.fromtimestamp(t) + +def date_weekinyear(date_str): + w = datetime.datetime.strptime(date, '%Y-%m-%d').strftime('%W') + return date_str[:5] + w + +def date_season(date_str): + m = date_str[5:7] + sl = { + '01':'1', + '02':'1', + '03':'1', + '04':'2', + '05':'2', + '06':'2', + '07':'3', + '08':'3', + '09':'3', + '10':'4', + '11':'4', + '12':'4', + } + s = sl.get(m) + return date_str[:5] + s + +def date_s