diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index 01d474c3..4feeb207 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -30,6 +30,11 @@ def GetTime(): #获得当前时间 currenttime = f"{t.tm_hour:0>2}{t.tm_min:0>2}{t.tm_sec:0>2}" return currenttime #返回当前时间hhmmss +def datestrtotimestamp(date_str): # 将yyyymmdd的时间转为时间戳timestamp(以分钟为单位的整数) + date_obj = time.strptime(date_str, "%Y%m%d") + timestamp = int(time.mktime(date_obj)) + return timestamp + def ReadTextFile(filepath): #读取文本格式的文件 with open(filepath,"r",encoding="u8") as f: data = f.read()