久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <small id='XxqUY'></small><noframes id='XxqUY'>

  1. <i id='XxqUY'><tr id='XxqUY'><dt id='XxqUY'><q id='XxqUY'><span id='XxqUY'><b id='XxqUY'><form id='XxqUY'><ins id='XxqUY'></ins><ul id='XxqUY'></ul><sub id='XxqUY'></sub></form><legend id='XxqUY'></legend><bdo id='XxqUY'><pre id='XxqUY'><center id='XxqUY'></center></pre></bdo></b><th id='XxqUY'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='XxqUY'><tfoot id='XxqUY'></tfoot><dl id='XxqUY'><fieldset id='XxqUY'></fieldset></dl></div>

    <tfoot id='XxqUY'></tfoot>
      <bdo id='XxqUY'></bdo><ul id='XxqUY'></ul>
      <legend id='XxqUY'><style id='XxqUY'><dir id='XxqUY'><q id='XxqUY'></q></dir></style></legend>

    1. Python UTC 日期時間對象的 ISO 格式不包括 Z(祖魯語

      Python UTC datetime object#39;s ISO format doesn#39;t include Z (Zulu or Zero offset)(Python UTC 日期時間對象的 ISO 格式不包括 Z(祖魯語或零偏移))

    2. <tfoot id='2A25l'></tfoot>
        <tbody id='2A25l'></tbody>
      • <bdo id='2A25l'></bdo><ul id='2A25l'></ul>
      • <legend id='2A25l'><style id='2A25l'><dir id='2A25l'><q id='2A25l'></q></dir></style></legend>
      • <small id='2A25l'></small><noframes id='2A25l'>

        <i id='2A25l'><tr id='2A25l'><dt id='2A25l'><q id='2A25l'><span id='2A25l'><b id='2A25l'><form id='2A25l'><ins id='2A25l'></ins><ul id='2A25l'></ul><sub id='2A25l'></sub></form><legend id='2A25l'></legend><bdo id='2A25l'><pre id='2A25l'><center id='2A25l'></center></pre></bdo></b><th id='2A25l'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2A25l'><tfoot id='2A25l'></tfoot><dl id='2A25l'><fieldset id='2A25l'></fieldset></dl></div>

                本文介紹了Python UTC 日期時間對象的 ISO 格式不包括 Z(祖魯語或零偏移)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                為什么 python 2.7 不像 JavaScript 那樣在 UTC 日期時間對象的 isoformat 字符串的末尾不包含 Z 字符(Zulu 或零偏移)?

                Why python 2.7 doesn't include Z character (Zulu or zero offset) at the end of UTC datetime object's isoformat string unlike JavaScript?

                >>> datetime.datetime.utcnow().isoformat()
                '2013-10-29T09:14:03.895210'
                

                而在 javascript 中

                Whereas in javascript

                >>>  console.log(new Date().toISOString()); 
                2013-10-29T09:38:41.341Z
                

                推薦答案

                Python datetime 對象默認沒有時區信息,沒有它,Python 實際上違反了 ISO 8601 規范(如果沒有給出時區信息,則假定為當地時間).您可以使用 pytz 包 來獲取一些默認時區,或者直接子類化 tzinfo 你自己:

                Python datetime objects don't have time zone info by default, and without it, Python actually violates the ISO 8601 specification (if no time zone info is given, assumed to be local time). You can use the pytz package to get some default time zones, or directly subclass tzinfo yourself:

                from datetime import datetime, tzinfo, timedelta
                class simple_utc(tzinfo):
                    def tzname(self,**kwargs):
                        return "UTC"
                    def utcoffset(self, dt):
                        return timedelta(0)
                

                然后你可以手動將時區信息添加到utcnow():

                Then you can manually add the time zone info to utcnow():

                >>> datetime.utcnow().replace(tzinfo=simple_utc()).isoformat()
                '2014-05-16T22:51:53.015001+00:00'
                

                請注意,這符合 ISO 8601 格式,該格式允許 Z+00:00 作為 UTC 的后綴.請注意,后者實際上更符合標準,通常表示時區(UTC 是一個特例.)

                Note that this DOES conform to the ISO 8601 format, which allows for either Z or +00:00 as the suffix for UTC. Note that the latter actually conforms to the standard better, with how time zones are represented in general (UTC is a special case.)

                這篇關于Python UTC 日期時間對象的 ISO 格式不包括 Z(祖魯語或零偏移)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個模塊和類)
                Configuring Python to use additional locations for site-packages(配置 Python 以使用站點包的其他位置)
                How to structure python packages without repeating top level name for import(如何在不重復導入頂級名稱的情況下構造python包)
                Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                How to refresh sys.path?(如何刷新 sys.path?)
                Distribute a Python package with a compiled dynamic shared library(分發帶有已編譯動態共享庫的 Python 包)

                    <i id='F3OpX'><tr id='F3OpX'><dt id='F3OpX'><q id='F3OpX'><span id='F3OpX'><b id='F3OpX'><form id='F3OpX'><ins id='F3OpX'></ins><ul id='F3OpX'></ul><sub id='F3OpX'></sub></form><legend id='F3OpX'></legend><bdo id='F3OpX'><pre id='F3OpX'><center id='F3OpX'></center></pre></bdo></b><th id='F3OpX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='F3OpX'><tfoot id='F3OpX'></tfoot><dl id='F3OpX'><fieldset id='F3OpX'></fieldset></dl></div>
                    1. <tfoot id='F3OpX'></tfoot>
                        <tbody id='F3OpX'></tbody>

                      • <small id='F3OpX'></small><noframes id='F3OpX'>

                        <legend id='F3OpX'><style id='F3OpX'><dir id='F3OpX'><q id='F3OpX'></q></dir></style></legend>
                          <bdo id='F3OpX'></bdo><ul id='F3OpX'></ul>
                          主站蜘蛛池模板: 久久麻豆精品 | 日韩视频精品在线 | 日本三级全黄三级三级三级口周 | 亚洲一区二区高清 | 日韩欧美高清dvd碟片 | 欧美一区2区三区4区公司二百 | 在线视频中文字幕 | 国产成人综合在线 | 日日艹夜夜艹 | 国产一级片网站 | 精品欧美一区二区三区久久久 | 欧美成人在线免费 | 亚洲美女网站 | 成年人黄色一级毛片 | 亚洲国产一区二区三区 | 国产目拍亚洲精品99久久精品 | 日本免费网 | 久久不射电影网 | 亚洲精品国产综合区久久久久久久 | 天堂一区二区三区 | 在线观看亚 | 极品粉嫩国产48尤物在线播放 | www.97zyz.com| 欧美一区二区三区在线观看 | 久久在线 | 中文字幕在线观看视频一区 | 美女国内精品自产拍在线播放 | 四虎影院一区二区 | 久久久精品一区二区三区四季av | 亚洲一区二区三区四区五区午夜 | 阿v视频在线观看 | 午夜精品一区二区三区在线观看 | 亚洲视频二区 | 国产精品99免费视频 | www,黄色,com | 亚洲一一在线 | 国产精品国产精品国产专区不蜜 | 午夜精品在线观看 | www.887色视频免费 | 中文二区 | 国产精品久久久久久久久久免费看 |