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.处理方法(处理方法有多种,可以传值到前端处理,也可以后台可以好之后再 ...
随机推荐
- Linux中让普通用户拥有超级用户的权限
问题 假设用户名为:ali 如果用户名没有超级用户权限,当输入 sudo + 命令 时, 系统提示: ali is not in the sudoers file. This incident wi ...
- 解决WORD2013输入时光标老跳的问题
Word2013有一个非常影响使用的bug.就是在编辑文档时,光标会乱跑,影响输入.微软给出了一个kb2863845 160多MB的补丁包,安装完成后就可以解决这个问题. 补丁下载链接: 链接:ht ...
- android和Linux下getopt的差别
1. Linux下如果找不到相对应的参数,则会跳过继续找下一个 Android下如果找不到则会直接返回-1,跳出来 2. Linux下通过getopt后会把找到的元素放到数组的前面,没找到的往后移动( ...
- [转]Using MVC 6 And AngularJS 2 With .NET Core
本文转自:http://www.c-sharpcorner.com/article/using-mvc-6-and-angularjs-2-with-net-core/ CoreMVCAngular2 ...
- Silverlight & Blend动画设计系列五:故事板(StoryBoards)和动画(Animations)
正如你所看到的,Blend是一个非常强大的节约时间的设计工具,在Blend下能够设计出很多满意的动画作品,或许他具体是怎么实现的,通过什么方式实现的我们还是一无所知.本篇将续前面几篇基础动画之上,详细 ...
- Tidb 离线Ansible方式部署实践
1.最近浏览到一个比较新的分布式数据库Tidb,开源看起来比较牛的样子,一时手痒就动手试试部署 2.参考官方 Ansible 离线方式部署 :https://pingcap.com/docs-cn/o ...
- [生活] 日常英语学习笔记-NEVER HAVE I EVER游戏
逛油管,看视频,学英语. 大家要过周末了说啥 Happy Sunday Have a restful Sunday 有个空闲的周末 我们正在看电影 We are watching movie it ...
- linux环境的基本搭建
1.准备Linux环境(我的是centos系统) 如果你是hadoop用户在使用sudo之前需要配置一下:获取sudo权限 切换到root vi /etc/sudoersroot ALL=(ALL) ...
- mysql-connector/python使用示例
1.下载安装connector/python 地址:https://dev.mysql.com/downloads/connector/python/ 下载的版本(mysql-connector-py ...
- Hello Activemq
0. 如果永远是localhost 可能一直low下去 1.下载安装 activemq 1.1 从官网下载activemq.tar.gz 并上传(rz)到linux系统 并解压 tar zxvf /* ...