Skip to content

Commit 5d645a2

Browse files
committed
Replace the deprecated datetime.datetime.utcfromtimestamp
Signed-off-by: stefan6419846 <[email protected]>
1 parent 24d436c commit 5d645a2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/commoncode/filetype.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88

99
import os
10-
from datetime import datetime
10+
from datetime import datetime, timezone
1111

1212
from commoncode.system import on_posix
1313
from commoncode.functional import memoize
@@ -164,7 +164,10 @@ def get_last_modified_date(location):
164164
yyyymmdd = ''
165165
if is_file(location):
166166
utc_date = datetime.isoformat(
167-
datetime.utcfromtimestamp(os.path.getmtime(location))
167+
datetime.fromtimestamp(
168+
os.path.getmtime(location),
169+
tz=timezone.utc,
170+
)
168171
)
169172
yyyymmdd = utc_date[:10]
170173
return yyyymmdd

0 commit comments

Comments
 (0)