简体   繁体   中英

How to convert ISO 8601 datetime in string list to utc datetime in python?

My code

在此处输入图像描述

Ouput:

在此处输入图像描述

Result I need:

在此处输入图像描述

How to convert to result I need from input list?

Tks for all helps!

tks for all attentions!

I find out solution

from datetime import datetime
from dateutil import parser

def get(date):
    date = [parser.parse(i) for i in date]
    return date

get(['2022-01-20T00:00:00.000Z' , '2022-02-21T00:00:00.000Z','2022-04-20T00:00:00.000Z'])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM