This commit is contained in:
InfinityPacer
2024-06-19 15:47:16 +08:00
22 changed files with 1325 additions and 73 deletions

View File

@ -383,6 +383,21 @@ class StringUtils:
print(str(e))
return timestamp
@staticmethod
def str_to_timestamp(date_str: str) -> float:
"""
日期转时间戳
:param date_str:
:return:
"""
if not date_str:
return 0
try:
return dateparser.parse(date_str).timestamp()
except Exception as e:
print(str(e))
return 0
@staticmethod
def to_bool(text: str, default_val: bool = False) -> bool:
"""