mirror of
https://github.com/xhongc/music-tag-web.git
synced 2026-02-03 10:13:30 +08:00
26 lines
601 B
Python
26 lines
601 B
Python
# coding:UTF-8
|
|
import datetime
|
|
import os
|
|
import time
|
|
|
|
|
|
def timestamp_to_dt(timestamp, format_type="%Y-%m-%d %H:%M:%S"):
|
|
# 转换成localtime
|
|
time_local = time.localtime(timestamp)
|
|
# 转换成新的时间格式(2016-05-05 20:28:54)
|
|
dt = time.strftime(format_type, time_local)
|
|
return dt
|
|
|
|
|
|
def folder_update_time(folder_name):
|
|
stat_info = os.stat(folder_name)
|
|
update_time = datetime.datetime.fromtimestamp(stat_info.st_mtime)
|
|
return update_time
|
|
|
|
|
|
def exists_dir(dir_list):
|
|
for _dir in dir_list:
|
|
if os.path.isdir(_dir):
|
|
return True
|
|
return False
|