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. Linux下获取java堆栈文件并进行分析

    当服务器内存飙升或者cpu负载飙升的时候,可以使用如下步骤排查问题: 1.终端输入top命令,键盘大写的情况下按P(cpu负载率从高到低排序)或者M(内存使用率从高到低排序),可以查看导致cpu或者内 ...

  2. 动手实践Mybatis插件

    前言 Mybatis的插件开发过程的前提是必须要对Mybatis整个SQL执行过程十分熟悉,这样才能正确覆盖源码保证插件运行,总的来说Mybatis的插件式一种侵入式插件,使用时应该十分注意. 在之前 ...

  3. LeetCode哈希表

    1. Two Sum https://leetcode.com/problems/two-sum/description/ 不使用额外空间需要n*n的复杂度 class Solution { publ ...

  4. 【转载】C#生成图片的缩略图

    图片处理是C#程序开发中时常会涉及到的一个业务,除了图像的上传.保存以及下载等功能外,根据上传的图片生成一个缩略图也是常见业务,在C#语言中,可以通过Image类提供的相关方法对图片进行操作,如指定宽 ...

  5. [angularjs] angularjs系列笔记(四)控制器

    Scope作用域 Scope作用域是应用在HTML视图和Js控制器之间的纽带 Scope是一个对象,有可用的属性和方法 根作用域 所有的应用都有一个$rootScope,它可以作用在ng-app指令包 ...

  6. Failed at the @ watch script 'cross-env NODE_ENV=development 使用cross-env解决跨平台设置NODE_ENV的问题

    今天在安装js依赖包时,根目录的package.json: { "private": true, "scripts": { "dev": & ...

  7. window 服务器的Tomcat 控制台日志保存到日志文件.

    在Linux系统中,Tomcat 启动后默认将很多信息都写入到 catalina.out 文件中,我们可以通过tail  -f  catalina.out 来跟踪Tomcat 和相关应用运行的情况. ...

  8. [HTML/CSS]浮动的那点事儿

    元素是怎样浮动 元素的水平方向浮动,意味着元素只能左右移动而不能上下移动. 一个浮动元素会尽量向左或向右移动,直到它的外边缘碰到包含框或另一个浮动框的边框为止. 浮动元素之后的元素将围绕它. 浮动元素 ...

  9. IE浏览器的ActiveXObject对象以及FileSystemobject的应用扩展(完成)

    ActiveXObject 对象 启用和返回对自动化对象的引用.此对象仅用于实例化自动化对象,且此对象没有成员. 警告:此对象为 Microsoft 扩展,仅在 Internet Explorer 中 ...

  10. 【代码笔记】Web-JavaScript-JavaScript错误

    一,效果图. 二,代码. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...