File size: 591 Bytes
6b4e7c6
 
5dedebd
28cc8f4
6b4e7c6
 
5dedebd
 
28cc8f4
 
6b4e7c6
5dedebd
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from datetime import datetime

from numpy.compat import long
import dateutil.tz


def format_date(section_date):
    # formatted_date = datetime.fromtimestamp(section_date).strftime('%Y-%m-%d %H:%M:%S')
    tz = dateutil.tz.gettz('Asia/Shanghai')
    return datetime.fromtimestamp(section_date / 1000, tz=tz)

    # # 使用datetime.strptime解析原始日期字符串
    # date_obj = datetime.strptime(section_date, "%Y%m%d%H%M")
    #
    # # 使用strftime将日期对象格式化为新的格式
    # formatted_date = date_obj.strftime("%Y%m%d %H:%M")
    #
    # return formatted_date