From 3d664d7816b190344ca78392f8e70907d5325bae Mon Sep 17 00:00:00 2001 From: wangweiye7840 Date: Tue, 26 Mar 2024 13:01:07 +0800 Subject: [PATCH] =?UTF-8?q?database=5Ftools=E4=B8=AD=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=B0=86=E6=97=A5=E6=9C=9F=E5=AD=97=E7=AC=A6=E4=B8=B2=E8=BD=AC?= =?UTF-8?q?=E4=B8=BA=E6=95=B4=E5=BD=A2=E6=97=A5=E6=9C=9F=E7=9A=84=E5=87=BD?= =?UTF-8?q?=E6=95=B0datestrtotimestamp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v2/database_tools.py | 5 +++++ 1 file changed, 5 insertions(+) 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()