You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
432 B
12 lines
432 B
import time
|
|
|
|
def get_local_timestr() -> str:
|
|
'''
|
|
获取当前时间的格式化字符串%Y-%m-%d %H:%M:%S
|
|
:return:
|
|
'''
|
|
timestamp = time.time()
|
|
# 转换为结构化时间对象,再格式化为字符串
|
|
struct_time = time.localtime(timestamp) # 本地时区时间:ml-citation{ref="3,5" data="citationList"}
|
|
formatted_time = time.strftime("%Y-%m-%d %H:%M:%S",struct_time)
|
|
return formatted_time
|