ebat obnova
This commit is contained in:
13
utils.py
Normal file
13
utils.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import datetime
|
||||
import os
|
||||
|
||||
def get_mod_time(path: str, format: str="%a %b %e %H:%M:%S %Z %Y") -> str:
|
||||
modify_time = os.path.getmtime(path)
|
||||
modify_datetime = datetime.datetime.fromtimestamp(modify_time)
|
||||
return modify_datetime.strftime(format)
|
||||
|
||||
|
||||
def get_create_time(path: str, format: str="%a %b %e %H:%M:%S %Z %Y") -> str:
|
||||
create_time = os.path.getctime(path)
|
||||
create_datetime = datetime.datetime.fromtimestamp(create_time)
|
||||
return create_datetime.strftime(format)
|
Reference in New Issue
Block a user