Directive Meaning Example Notes
%a Weekday as locale’s abbreviated name.
Sun, Mon, …, Sat (en_US);
So, Mo, …, Sa (de_DE)
(1)
%A Weekday as locale’s full name.
Sunday, Monday, …, Saturday (en_US);
Sonntag, Montag, …, Samstag (de_DE)
(1)
%w Weekday as a decimal number, where 0 is Sunday and 6 is Saturday. 0, 1, …, 6  
%d Day of the month as a zero-padded decimal number. 01, 02, …, 31  
%b Month as locale’s abbreviated name.
Jan, Feb, …, Dec (en_US);
Jan, Feb, …, Dez (de_DE)
(1)
%B Month as locale’s full name.
January, February, …, December (en_US);
Januar, Februar, …, Dezember (de_DE)
(1)
%m Month as a zero-padded decimal number. 01, 02, …, 12  
%y Year without century as a zero-padded decimal number. 00, 01, …, 99  
%Y Year with century as a decimal number. 1970, 1988, 2001, 2013  
%H Hour (24-hour clock) as a zero-padded decimal number. 00, 01, …, 23  
%I Hour (12-hour clock) as a zero-padded decimal number. 01, 02, …, 12  
%p Locale’s equivalent of either AM or PM.
AM, PM (en_US);
am, pm (de_DE)
(1), (2)
%M Minute as a zero-padded decimal number. 00, 01, …, 59  
%S Second as a zero-padded decimal number. 00, 01, …, 59 (3)
%f Microsecond as a decimal number, zero-padded on the left. 000000, 000001, …, 999999 (4)
%z UTC offset in the form +HHMM or -HHMM (empty string if the the object is naive). (empty), +0000, -0400, +1030 (5)
%Z Time zone name (empty string if the object is naive). (empty), UTC, EST, CST  
%j Day of the year as a zero-padded decimal number. 001, 002, …, 366  
%U Week number of the year (Sunday as the first day of the week) as a zero padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0. 00, 01, …, 53 (6)
%W Week number of the year (Monday as the first day of the week) as a decimal number. All days in a new year preceding the first Monday are considered to be in week 0. 00, 01, …, 53 (6)
%c Locale’s appropriate date and time representation.
Tue Aug 16 21:30:00 1988 (en_US);
Di 16 Aug 21:30:00 1988 (de_DE)
(1)
%x Locale’s appropriate date representation.
08/16/88 (None);
08/16/1988 (en_US);
16.08.1988 (de_DE)
(1)
%X Locale’s appropriate time representation.
21:30:00 (en_US);
21:30:00 (de_DE)
(1)
%% A literal '%' character. %  

Python: datetime 转换的更多相关文章

  1. python datetime 时间日期处理小结

    python datetime 时间日期处理小结 转载请注明出处:http://hi.baidu.com/leejun_2005/blog/item/47f340f1a85b5cb3a50f5232. ...

  2. python datetime.datetime is not JSON serializable

    1.主要是python  list转换成json时对时间报错:datetime.datetime(2014, 5, 23, 9, 33, 3) is not JSON serializable. 2. ...

  3. python datetime和unix时间戳之间相互转换

                                python datetime和unix时间戳之间相互转换 1.代码:    import time    import datetime # ...

  4. Python datetime 转 JSON

    Python datetime 转 JSON Python 中将 datetime 转换为 JSON 类型,在使用 Django 时遇到的问题. 环境: Python2.7 代码: import js ...

  5. allow zero datetime=true导致datetime转换失败:MySql.Data.Types.MySqlDateTime”的对象无法转换为类型“System.Nullable`1[System.DateTime]

    allow zero datetime=true导致datetime转换失败:MySql.Data.Types.MySqlDateTime”的对象无法转换为类型“System.Nullable`1[S ...

  6. Django model '__week_day'与python datetime的weekday()

    上周出了个bug,按星期几查询数据的时候,发现查到的数据与显示的星期几并不相符,后来发现代码中按星期几查询,有的地方用的是Django QuerySet提供的'__week_day',有的地方用的是p ...

  7. python datetime笔记

    python datetime笔记 http://mint-green.diandian.com/post/2011-09-09/4892024 获取当前时间,并通过字符串输出. 格式为:%Y-%m- ...

  8. python datetime模块strptime/strptime format常见格式命令_施罗德_新浪博客

    python datetime模块strptime/strptime format常见格式命令_施罗德_新浪博客     python datetime模块strptime/strptime form ...

  9. python如何转换word格式、读取word内容、转成html

    # python如何转换word格式.读取word内容.转成html? import docx from win32com import client as wc # 首先将doc转换成docx wo ...

随机推荐

  1. Go基础系列:读取标准输入

    fmt包中提供了3类读取输入的函数: Scan家族:从标准输入os.Stdin中读取数据,包括Scan().Scanf().Scanln() SScan家族:从字符串中读取数据,包括Sscan().S ...

  2. 第一册:lesson fifty three。

    原文: An interesting climate. A:where do you come from? B:I come from England. A:What's the climate li ...

  3. 利用http协议对搜索引擎劫持

    主要是利用了http协议的refereer头 另外一个头user-agnet 主要是用来做流量劫持 referer 头告诉服务器用户从哪里找来的 当用户通过搜索引擎打开网站时会出现源网页 refere ...

  4. 【Java每日一题】20170223

    20170222问题解析请点击今日问题下方的“[Java每日一题]20170223”查看(问题解析在公众号首发,公众号ID:weknow619) package Feb2017; public cla ...

  5. redirection in linux

    2>&1 # Redirects stderr to stdout. # Error messages get sent to same place as standard output ...

  6. Java 控制类的引用类型,合理使用内存

    Java提供了 java.lang.ref包,该包下的类均与垃圾回收机制相关 先介绍Java对象的集中引用类型 1.强引用 强引用是最常见的,创建对象就是强引用,如 String a = new St ...

  7. node实现简单的群体聊天工具

    一.使用的node模块 1.express当做服务器 2.socket.io 前后通信的桥梁 3.opn默认打开浏览器的模块(本质上用不到) 难点:前后通信 源码地址:https://github.c ...

  8. Less 结合 nth-child 选择器循环生成样式

    问题描述: 实现头像的堆叠效果 从第二个头像开始,每个头像都会盖住前一个头像上,遮盖的宽度为 30px 实现叠加的方式有很多,比如给每个头像添加 translateX 属性,或者使用负值 margin ...

  9. 带你了解源码中的 ThreadLocal

    本篇文章已授权微信公众号 guolin_blog (郭霖)独家发布 这次想来讲讲 ThreadLocal 这个很神奇的东西,最开始接触到这个是看了主席的<开发艺术探索>,后来是在研究 Vi ...

  10. cf932E. Team Work(第二类斯特灵数 组合数)

    题意 题目链接 Sol 这篇题解写的非常详细 首先要知道第二类斯特灵数的一个性质 \[m^n = \sum_{i = 0}^m C_{n}^i S(n, i) i!\] 证明可以考虑组合意义:\(m^ ...