python中时间日期格式化符号的含义
- %y 两位数的年份表示(00-99)
- %Y 四位数的年份表示(000-9999)
- %m 月份(01-12)
- %d 月内中的一天(0-31)
- %H 24小时制小时数(0-23)
- %I 12小时制小时数(01-12)
- %M 分钟数(00=59)
- %S 秒(00-59)
- %a 本地简化星期名称
- %A 本地完整星期名称
- %b 本地简化的月份名称
- %B 本地完整的月份名称
- %c 本地相应的日期表示和时间表示
- %j 年内的一天(001-366)
- %p 本地A.M.或P.M.的等价符
- %U 一年中的星期数(00-53)星期天为星期的开始
- %w 星期(0-6),星期天为星期的开始
- %W 一年中的星期数(00-53)星期一为星期的开始
- %x 本地相应的日期表示
- %X 本地相应的时间表示
- %Z 当前时区的名称
- %% %号本身
| Code | Meaning | Example |
|---|---|---|
%a |
Weekday as locale’s abbreviated name. | Mon |
%A |
Weekday as locale’s full name. | Monday |
%w |
Weekday as a decimal number, where 0 is Sunday and 6 is Saturday. | 1 |
%d |
Day of the month as a zero-padded decimal number. | 30 |
%-d |
Day of the month as a decimal number. (Platform specific) | 30 |
%b |
Month as locale’s abbreviated name. | Sep |
%B |
Month as locale’s full name. | September |
%m |
Month as a zero-padded decimal number. | 09 |
%-m |
Month as a decimal number. (Platform specific) | 9 |
%y |
Year without century as a zero-padded decimal number. | 13 |
%Y |
Year with century as a decimal number. | 2013 |
%H |
Hour (24-hour clock) as a zero-padded decimal number. | 07 |
%-H |
Hour (24-hour clock) as a decimal number. (Platform specific) | 7 |
%I |
Hour (12-hour clock) as a zero-padded decimal number. | 07 |
%-I |
Hour (12-hour clock) as a decimal number. (Platform specific) | 7 |
%p |
Locale’s equivalent of either AM or PM. | AM |
%M |
Minute as a zero-padded decimal number. | 06 |
%-M |
Minute as a decimal number. (Platform specific) | 6 |
%S |
Second as a zero-padded decimal number. | 05 |
%-S |
Second as a decimal number. (Platform specific) | 5 |
%f |
Microsecond as a decimal number, zero-padded on the left. | 000000 |
%z |
UTC offset in the form +HHMM or -HHMM (empty string if the the object is naive). | |
%Z |
Time zone name (empty string if the object is naive). | |
%j |
Day of the year as a zero-padded decimal number. | 273 |
%-j |
Day of the year as a decimal number. (Platform specific) | 273 |
%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. | 39 |
%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. | 39 |
%c |
Locale’s appropriate date and time representation. | Mon Sep 30 07:06:05 2013 |
%x |
Locale’s appropriate date representation. | 09/30/13 |
%X |
Locale’s appropriate time representation. | 07:06:05 |
%% |
A literal '%' character. | % |
python中时间日期格式化符号的含义的更多相关文章
- python中时间日期格式化符号
python中时间日期格式化符号: import time print(time.strftime('%Y%H%M%S', time.localtime())) 运行结果: 2016092308 %y ...
- python中时间日期格式化符号:
%y 两位数的年份表示(00-99) %Y 四位数的年份表示(000-9999) %m 月份(01-12) %d 月内中的一天(0-31) %H 24小时制小时数(0-23) %I 12小时制小时数( ...
- Java中时间日期格式化
1.与日期时间相关的类: 第一:java.util.Date; 将时间作为一个整体使用.处理时,使用Date类较为简便 第二:j ...
- 整理总结 python 中时间日期类数据处理与类型转换(含 pandas)
我自学 python 编程并付诸实战,迄今三个月. pandas可能是我最高频使用的库,基于它的易学.实用,我也非常建议朋友们去尝试它.--尤其当你本身不是程序员,但多少跟表格或数据打点交道时,pan ...
- Python中的日期和时间
感觉C语言作为一门编程的入门语言还是很好的,相比较之下,Python为代表的一些语言,适合很多非计算机专业的编程入门学习. Python 日期和时间 Python 程序能用很多方式处理日期和时间,转换 ...
- python日期格式化符号
python中时间日期格式化符号: %y 两位数的年份表示(00-99) %Y 四位数的年份表示(000-9999) %m 月份(01-12) %d 月内中的一天(0-31) %H 24小时制小时数( ...
- python中时间的基本使用
格式化日期 我们可以使用 time 模块的 strftime 方法来格式化日期,: time.strftime(format[, t]) #!/usr/bin/python # -*- coding: ...
- Python中关于日期的计算总结
1.获取当前时间的两种方法: 代码如下: import datetime,timenow = time.strftime("%Y-%m-%d %H:%M:%S")print now ...
- Python时间日期格式化之time与datetime模块总结
1 引言 在实际开发过程中,我们经常会用到日期或者时间,那么在Python中我们怎么获取时间,以及如何将时间转换为我们需要的格式呢?在之前的开发中,也曾遇到time.datetime等模块下的不同函数 ...
随机推荐
- BIOS维修技术
BIOS是电脑中最基础且最重要的程序,为电脑提供最低级且最直接的硬件控制,电脑的原始操作都是依照固化在BIOS里的程序来完成的.因此如果BIOS出现故障将会导致影响电脑的正常工作.BIOS故障有很多, ...
- AML LCD debuged
root@k101:/ # cat /sys/class/lcd/debug Usage: echo basi ...
- Vue 之 npm 及 安装的包
1 npm相关 1.1 npm 是 基于Node.js 的,所以要先安装Node.js 在浏览器地址栏输入https://nodejs.org/en/, 进入Node.js官网后,点击下载左边的稳定 ...
- 把x指针指向的4个字节次序颠倒过来
举例:x指向的内存地址,其字节内容从低到高依次分别为c1,c2,c3,c4(Delphi读取一个integer的时候,结果是c4c3c2c1,其排列规则是"高高低低"),那么结果是 ...
- XMU C语言程序设计实践(5)
• 使用动态链表完成一个简单的商品库存信息管理系统. • 商品信息包括如下字段:商品号.商品名称.商品库存 • 函数 create:接收用户输入的商品号和商品名称的 ...
- VK Cup 2016 - Round 1 (Div. 2 Edition) C. Bear and Forgotten Tree 3
C. Bear and Forgotten Tree 3 time limit per test 2 seconds memory limit per test 256 megabytes input ...
- gnss到底是什么呢
GNSS Global Navigation Satellite System 全球卫星导航系统:提到这个很多人会不明白GNSS倒是是个啥东西呢,和北斗,GPS, GLONASS,Galileo系统有 ...
- CentOS7.2编译GCC7.3
1.环境 本文使用VMWare虚拟机进行实验. 4 核CPU, 4GB 内存,20GB 硬盘,CentOS 7.2 最小安装(CentOS-7-x86_64-Minimal-1511.iso) 2.需 ...
- local_irq_disable
local_irq_disable 仅仅是 设置 当前CPU 的中断屏蔽位 disable_irq 是禁用 全部cpu 中断(只是当前irq) 如果你要禁止所有的中断该怎么办? 在2.6内核中,可以通 ...
- JAVA 单选样式编写
<td class="main_matter_td">管网供水情况</td> <td align="left" class=&qu ...