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.处理方法(处理方法有多种,可以传值到前端处理,也可以后台可以好之后再 ...
随机推荐
- LVS+keepalived DR模式配置高可用负载均衡集群
实验环境 LVS-Master 10.0.100.201 VIP:10.0.100.203 LVS-Slave 10.0.100.204 WEB1-Tomcat 10.0.2.29 gat ...
- jQuery 整体架构
不同于 jQuery 代码各个模块细节实现的晦涩难懂,jQuery 整体框架的结构十分清晰,按代码行文大致分为如上图所示的模块. 初看 jQuery 源码可能很容易一头雾水,因为 9000 行的代码感 ...
- mongodb操作之mongoose
/** * Created by chaozhou on 2015/10/6. */ var mongoose = require("mongoose"); var db = mo ...
- HttpResponse Entity的处理(将字符数组转为JSON)
1.问题背景 调用高德的IP地址查询接口,获取的返回值为字符串数组(如下); 因为这里只是纯字符串,并不是真正的数组,无法直接取值,所以想到看能不能转为数组或者JSON再进行取值. 2.解决: 通过在 ...
- MyBatis入门篇
一.什么是MyBatis MyBatis 本是apache的一个开源项目iBatis, 2010年这个项目由apache software foundation 迁移到了google code,并且改 ...
- Eclipse自定义启动画面和状态栏图标以及各种小图标的含义
一. 启动画面自定义 第一种情况:纯Eclipse 找到Eclipse安装路径下\eclipse\plugins\org.eclipse.platform_3.7.2.v201202080800,具体 ...
- mui ajax 应用的跨域问题
1.首先在mui.ajax的error函数里出现: “syntaxerror unexpected token <” 这样的错误,那么在 mui.ajax中的type写成 JSONP ,后台需 ...
- myeclipse 下载 checkstyle 引入后不显示问题
参照这篇博客,http://blog.csdn.net/zzq900503/article/details/42003499 下载最新的checkstyle版本后,在本地导入后一直不显示,步骤什么的也 ...
- png的故事:隔行扫描算法
转载自AlloyTeam:http://www.alloyteam.com/2017/06/the-story-of-png-deinterlacing-algorithm/ 前言 前文已经讲解过如何 ...
- CentOS 附加软件包
本人初学 CentOS,安装软件与 windows 下区别很大,大部分得通过 yum install xxx .这有个问题,一方面 yum 资源有限,另一方面 yum 默认装的版本较低.比如 Cent ...