简体   繁体   English

如何将字符串列表中的 ISO 8601 日期时间转换为 python 中的 utc 日期时间?

[英]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! tks 所有的关注!

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'])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将字符串中的日期时间转换为 ISO 格式,然后转换为 UTC - Convert a datetime in string to ISO format and then to UTC 如何在python 3.5中使用毫秒而不是微秒获取日期时间的ISO8601字符串 - How to get ISO8601 string for datetime with milliseconds instead of microseconds in python 3.5 将iso格式的日期时间字符串转换为Python中的日期时间对象 - Convert iso format datetime string to datetime object in Python 如何将字符串日期时间转换为 UTC UNIX? - How to convert string datetime to UTC UNIX? 如何在 Python 中将 UTC/扩展格式转换为日期时间 - How to convert UTC/extended format to datetime in Python 计算ISO 8601的日期时间差 - calculating a datetime difference for ISO 8601 将具有时区的字符串转换为utc datetime对象python - convert string having timezone into to utc datetime object python 如何在 python 中不导入 datetime 的情况下将字符串 datetime 转换为 datetime? - How can convert the string datetime to datetime without import datetime in python? PyMongo/Python/Airflow - 将 CST 日期/日期时间转换为 UTC 并以 ISO 格式存储在 MongoDB 中? - PyMongo/Python/Airflow - Convert CST Date/DateTime to UTC and store in MongoDB in ISO format? 如何在Python3中将UTC日期字符串转换为时区感知日期时间对象? - How to convert a UTC date string to timezone aware datetime object in Python3?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM