database_tools增添GetTime工具

This commit is contained in:
wangweiye7840 2024-01-23 13:41:13 +08:00
parent 3bcc692c6b
commit 497c319ac9
1 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,11 @@ def GetDate(): #获得当前日期
currentdate = str(time.localtime().tm_year)+str(time.localtime().tm_mon).zfill(2)+str(time.localtime().tm_mday).zfill(2)
return currentdate #返回当前日期yyyymmdd
def GetTime(): #获得当前时间
t = time.localtime()
currenttime = f"{t.tm_hour:0>2}{t.tm_min:0>2}{t.tm_sec:0>2}"
return currenttime #返回当前时间hhmmss
def ReadTextFile(filepath): #读取文本格式的文件
with open(filepath,"r",encoding="u8") as f:
data = f.read()