omit microseconds from file name
This commit is contained in:
@@ -25,12 +25,15 @@ def to_date_str(_date: dict):
|
||||
return f"{_date['year']:04d}-{_date['month']:02d}-{_date['day']:02d}"
|
||||
|
||||
|
||||
def create_timestamp():
|
||||
def create_timestamp(with_ms=True):
|
||||
if sys.version_info.major > 2 and sys.version_info.minor > 9:
|
||||
now = datetime.datetime.now(datetime.UTC)
|
||||
else:
|
||||
now = datetime.datetime.utcnow()
|
||||
res = now.strftime('%Y-%m-%dT%H:%M:%S') + ('.%03dZ' % (now.microsecond / 1000))
|
||||
|
||||
res = now.strftime('%Y-%m-%dT%H:%M:%S')
|
||||
if with_ms:
|
||||
res += ('.%03dZ' % (now.microsecond / 1000))
|
||||
return res
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user