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.处理方法(处理方法有多种,可以传值到前端处理,也可以后台可以好之后再 ...
随机推荐
- SpringMVC入门(一)
非注解的SpringMVC 1.创建一个web工程 2.导入工程需要的jar包 3.配置SpringMVC的前端控制器 前端控制器(DispatcherAdapter)需要在web.xml文件中进行 ...
- Linux中常用头文件的作用--转
http://blog.sina.com.cn/s/blog_5c93b2ab0100q62k.html 1. Linux中一些头文件的作用: <assert.h>:ANSI C.提供断言 ...
- [转]error MSB4018: The "GenerateResource" task failed unexpectedly
本文转自:https://github.com/Microsoft/msbuild/issues/364 After uninstall Visual Studio 2015 Update 1 RC ...
- JS实现图片预览与等比缩放
案例仅为图片预览功能,省略图片上传步骤,框架为easyui. HTML代码: @*text-align:center;水平居中 vertical-align: middle;display: tabl ...
- ASP.NET MVC4 新手入门教程特别篇之一----Code First Migrations更新数据库结构(数据迁移)修改Entity FrameWork 数据结构(不删除数据)
背景 code first起初当修改model后,要持久化至数据库中时,总要把原数据库给删除掉再创建(DropCreateDatabaseIfModelChanges),此时就会产生一个问题,当我们的 ...
- Tomcat Post请求大小限制
理论上讲,POST是没有大小限制的.HTTP协议规范也没有进行大小限制,起限制作用的是服务器的处理程序的处理能力. 如:在Tomcat下取消POST大小的限制(Tomcat默认2M): 打开tomca ...
- Luogu3403: 跳楼机
题面 传送门 Sol 有一个显然的想法 处理出\(y, z\)能凑出的高度 然后这些高度凑一些\(x\)就可以得到其它的高度 那么可以把这些\(y, z\)凑出的高度对\(x\)取模,其它的用\(x\ ...
- 26_线程池_ThreadPoolExecutor
[ThreadPoolExecutor简述] 无论是Executors类的newFixedThreadPool().newSingleThreadExecutor(),还是newCachedThrea ...
- 孙鑫VC++视频教程(1-20课全)
孙鑫VC++视频教程(1-20课全)PPT讲义和源代码 http://down.51cto.com/data/467760 孙鑫VC++从入门到精通开发详解视频教程[20讲] http://down. ...
- 【Supervised Learning】支持向量机SVM (to explain Support Vector Machines (SVM) like I am a 5 year old )
Support Vector Machines 引言 内核方法是模式分析中非常有用的算法,其中最著名的一个是支持向量机SVM 工程师在于合理使用你所拥有的toolkit 相关代码 sklearn-SV ...