datetime中时间的formatter整理
print datetime.datetime.now().strftime("%Y.%m.%d")
|
Directive |
Meaning |
|
%a |
Locale’s abbreviated weekday name. 缩写的星期几英文名称。 |
|
%A |
Locale’s full weekday name. 完整的星期几英文名称。 |
|
%b |
Locale’s abbreviated month name. 缩写的月份英文名称。 |
|
%B |
Locale’s full month name. 完整的月份英文名称。 |
|
%c |
Locale’s appropriate date and time representation. 一个适当的“日期+时间”表示法,我这里的结果是“月/日/年 时:分:秒”。 |
|
%d |
Day of the month as a decimal number [01,31]. 现在日。 |
|
%H |
Hour (24-hour clock) as a decimal number [00,23]. 现在小时(24小时制)。 |
|
%I |
Hour (12-hour clock) as a decimal number [01,12]. 现在小时(12小时制)。 |
|
%j |
Day of the year as a decimal number [001,366]. 现在是一年中的第几天。 |
|
%m |
Month as a decimal number [01,12]. 现在月。 |
|
%M |
Minute as a decimal number [00,59]. 现在分。 |
|
%p |
Locale’s equivalent of either AM or PM. 现在上/下午,用AM/PM表示。仅与%I一块使用。 |
|
%S |
Second as a decimal number [00,61]. 现在秒。 |
|
%U |
Week number of the year (Sunday as the first day of the week) as a decimal number [00,53]. All days in a new year preceding the first Sunday are considered to be in week 0. 现在是一年中的第几个星期。从第一个星期日开始算第1个星期,之前算第0个。 |
|
%w |
Weekday as a decimal number [0(Sunday),6]. 现在的星期数,星期日算0。 |
|
%W |
Week number of the year (Monday as the first day of the week) as a decimal number [00,53]. All days in a new year preceding the first Monday are considered to be in week 0. 现在是一年中的第几个星期。从第一个星期一开始算第1个星期,之前算第0个。 |
|
%x |
Locale’s appropriate date representation. 一个适当的“日期”表示法,我这里的结果是“月/日/年”。 |
|
%X |
Locale’s appropriate time representation. 一个适当的“时间”表示法,我这里的结果是“时:分:秒”。 |
|
%y |
Year without century as a decimal number [00,99]. 现在年(后两位)。 |
|
%Y |
Year with century as a decimal number. 现在年(完整四位)。 |
|
%Z |
Time zone name (no characters if no time zone exists). 时区名称(如果没有时区则空白)。 |
|
%% |
A literal '%' character. 百分号的转义符。 |
如果看不明白具体长什么样,可以用本文开头那条语句来测试。
就酱。
PS:博客园的表格好坑啊!and图没有什么用,但是如果不加的话,就给什么乱七八糟的东西打广告了。

datetime中时间的formatter整理的更多相关文章
- mysql中时间字段datetime怎么判断为空和不为空
mysql中时间字段datetime怎么判断为空和不为空一般为空都用null表示,所以一句sql语句就可以.select * from 表名 where 日期字段 is null;这里要注意null的 ...
- Python中时间的处理之——timedelta篇
#! /usr/bin/python # coding=utf-8 from datetime import datetime,timedelta """ timed ...
- python中时间格式
问题:通过MySQLdb查询datetime字段,然后通过浏览器显示出来,得到的格式是: 'Thu, 19 Feb 2009 16:00:07 GMT' (http呈现出来的格式) ...
- javascript中字符串常用操作整理
javascript中字符串常用操作整理 字符串的操作在js中非常频繁,也非常重要.以往看完书之后都能记得非常清楚,但稍微隔一段时间不用,便会忘得差不多,记性不好是硬伤啊...今天就对字符串的一些常用 ...
- python基础 ---time,datetime,collections)--时间模块&collections 模块
python中的time和datetime模块是时间方面的模块 time模块中时间表现的格式主要有三种: 1.timestamp:时间戳,时间戳表示的是从1970年1月1日00:00:00开始按秒计算 ...
- Asp.Net Core中Json序列化处理整理
一.Asp.Net Core中的Json序列化处理使用的是Newtonsoft.Json,更多参考:C# Newtonsoft.Json JsonSerializerSettings配置序列化操作,C ...
- .NetCore中EFCore的使用整理(二)-关联表查询
EF常用处理关联加载的方式有3中:延迟加载(Lazy Loading).贪婪加载 (Eager Loading)以及显示加载. 一.EF Core 1.1 1.当前的版本,还不支持延迟加载(Lazy ...
- .NetCore中EFCore for MySql整理
一.MySql官方提供了Ef Core对MySql的支持,但现在还处于预览版 Install-Package MySql.Data.EntityFrameworkCore -Pre Install-P ...
- js 中时间格式化的几种方法
1.项目中时间返回值,很过时候为毫秒值,我们需要转换成 能够看懂的时间的格式: 例如: yyyy-MM-dd HH:mm:ss 2.处理方法(处理方法有多种,可以传值到前端处理,也可以后台可以好之后再 ...
随机推荐
- Java ee 之 html/css样式复习
内容: 1,html/css样式 2,模拟简书注册登陆页面 *重点: 1,width:auto;height:auto; 2,background-image:url(Q5.png);left top ...
- IE678下,select 诡异的样式
我没有IE6,我用IE5测试的. IE5下的测试结果:貌似只能设置 width ,设置其他的都失效,连 height 都不例外. IE7下的测试结果:垂直居中失效.边框失效,宽高生效. IE8下的测试 ...
- Centos 从零开始 (四)
12:nginx架设 rtmp直播 首先在之前 所安装的nginx是用 yum 源安装的.却不能为nginx添加他的模块 所以要用wget来下载源文件 来进行源码配置与安装.开搞 [root@loca ...
- 三:Maven创建问题
1.httpServlet was not found 设置server为tomcat,jre设置为安装的jdk的jre java build path 添加server runtime为tomcat ...
- springboot aop使用介绍
第一步:添加依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId&g ...
- 解决maven项目中,缺少 maven dependencies
因为项目需要将普通项目转换为maven项目,在右键 ’项目‘configure 后,添加maven后,发现缺少 maven dependencies,于是从网上找了一些处理措施,大体上是在.class ...
- PAT 1082. Read Number in Chinese
#include <cstdio> #include <cstdlib> #include <string> #include <vector> #in ...
- browserslist 目标浏览器配置表
为什么需要: 根据提供的目标浏览器的环境来,智能添加css前缀,js的polyfill垫片,来兼容旧版本浏览器,而不是一股脑的添加.避免不必要的兼容代码,以提高代码的编译质量. 共享使用browser ...
- JavaScript常用类
JS常用类 一.Number 1.常用数字 整数:10 小数:3.14 科学计数法:1e5 | 1e-5 正负无穷:Infinity | -Infinity 2.常用进制 二进制:0b1010 八进制 ...
- easyui numberbox输入框 编辑不可编辑的切换
背景:申请单里需要选费用类型,费用类型有的有子明细项,有个合计项 当有子明细项的时候,合计项的值是通过弹出的子明细项价格的总和(设置为可编辑没问题,因为点击出来弹框,编辑不了) 没有子明细 ...