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等模块下的不同函数 ...
随机推荐
- Android的onMeasure方法
在Android开发中,当Android原生控件不能满足我们的需求的时候,就需要自定义View.View在屏幕上绘制出来先要经过measure(计算)和layout(布局). 什么时候调用onMeas ...
- 编程算法 - 数组中出现次数超过一半的数字 代码(C)
数组中出现次数超过一半的数字 代码(C) 本文地址: http://blog.csdn.net/caroline_wendy 题目: 数组中有一个数字出现的次数超过数组长度的一半, 请找出这个数字. ...
- CentOS笔记-目录结构(转载了菜鸟教程里的)
在linux系统中,有几个目录是比较重要的,平时需要注意不要误删除或者随意更改内部文件. /etc: 上边也提到了,这个是系统中的配置文件,如果你更改了该目录下的某个文件可能会导致系统不能启动. /b ...
- Ehcache CacheManager
CacheManager是Ehcache框架的核心类和入口,它负责管理一个或多个Cache对象.要使用Ehcache框架,必须要先创建 CacheManager 对象.现在我们学习下,如何创建 Cac ...
- strncpy和strlen的可能的实现
#include <stdio.h> #include <stdlib.h>//为避免与标准库中的函数发生混淆,我将它们命名为stringNCopy和stringLength ...
- React通用后台管理系统
react-admin 部分采用了antd,相关功能较全,添加了较多的组件模块.star 664 GitHub:https://github.com/yezihaohao/react-admin 在线 ...
- RK3399参考设计方案之DC-DC电源芯片RK808D【转】
本文转载自:http://www.52rd.com/Blog/Detail_RD.Blog_sunnyqi_90673.html?WebShieldDRSessionVerify=Xv0bsGtD73 ...
- HDU3667 Transportation —— 最小费用流(费用与流量平方成正比)
题目链接:https://vjudge.net/problem/HDU-3667 Transportation Time Limit: 2000/1000 MS (Java/Others) Me ...
- YTU 2421: C语言习题 矩形法求定积分
2421: C语言习题 矩形法求定积分 时间限制: 1 Sec 内存限制: 128 MB 提交: 354 解决: 234 题目描述 写一个用矩形法求定积分的通用函数,分别求 (说明: sin,co ...
- Oracle中如何用SQL检测字段是否包括中文字符
用Oracle的编码转换的函数Convert实现,测试后可行. SQL> select * 2 from (select 'abcd' c1 from dual 3 ...