Python datetime模块
来源:互联网 发布:网络知名小说家排行榜 编辑:程序博客网 时间:2024/06/06 05:27
Python datetime模块是使用Python开发中常用的模块之一,在使用过程中也会遇到很多问题,最重要的是把文档看明白并熟练掌握,在datetime模块中有以下几个类
目录
Python datetime模块之datetime
Python datetime 模块之timedelta
Python datetime模块之date
Python datetime模块之time
还有2个类,tzinfo、timezone。首先是我没明白这两个类是什么意思,其次,我不知道这个有什么用(废话,不知道什么意思,当然不知道用法了)。总而言之,是我愚钝。
tzinfo是一个抽象类,不能直接实例化,需要派生出一个子类。至少应该通过datetime的方法实现tzinfo中的方法,datetime模块中有一个tzinfo的派生类 timezone。
一个tzinfo的派生类可以在datetime和time的构造函数中。我 只理解这些,至于这个有什么用,我只知道是用于不同时区之间的时间偏移量和时区的相关方法。
以下是Python中时间的占位符表格:
AM, PM (en_US);am, pm (de_DE)
%MMinute as a zero-padded decimal number.以0填充的十进制数表示分钟00, 01, ..., 59%SSecond as a zero-padded decimal number.以0填充的十进制数表示秒00, 01, ..., 59%fMicrosecond as a decimal number, zero-padded on the left.以0填充的十进制数表示微秒000000, 000001, ..., 999999%zUTC offset in the form +HHMM or -HHMM (empty string if the the object is naive).+HHMM或-HHMM形式的UTC偏移(如果对象是naive的,则为空字符串)。(empty), +0000, -0400, +1030%ZTime zone name (empty string if the object is naive).时区名称(如果对象是naive的,则为空字符串)。(empty), UTC, EST, CST%jDay of the year as a zero-padded decimal number.以0填充的十进制数字表示的一年中的日期。001, 002, ..., 366%UWeek 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.以0填充的十进制数字表示的一年中的周。00, 01, ..., 53%WWeek 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.以0填充的十进制数字表示的一年中的周。00, 01, ..., 53%cLocale’s appropriate date and time representation.适合区域设置的日期和时间表示。Tue Aug 16 21:30:00 1988 (en_US);Di 16 Aug 21:30:00 1988 (de_DE)%xLocale’s appropriate date representation.适合区域的日期表示。08/16/88 (None);08/16/1988 (en_US);16.08.1988 (de_DE)%XLocale’s appropriate time representation.适合区域的日期表示。21:30:00 (en_US);21:30:00 (de_DE)%%A literal '%' character.%以上文档来源于:https://python.freelycode.com/doc/python_3_5_0/library/datetime.html?highlight=datetime#datetime.tzinfo
如有出入,麻烦指出。谢谢
0 0
- Python datetime模块之datetime
- Python模块之----datetime
- python---time,datetime模块
- Python模块学习 ---- datetime
- Python模块学习 ---- datetime
- Python模块学习 ---- datetime
- Python模块学习 ---- datetime
- python datetime模块 简介
- Python模块学习 ---- datetime
- Python模块学习 ---- datetime
- Python模块学习 ---- datetime
- Python datetime模块
- Python模块datetime
- python datetime模块
- Python模块学习 ---- datetime
- Python模块学习 ---- datetime
- Python模块学习 ---- datetime
- Python模块学习 ---- datetime
- TypeScript学习笔记之基本类型
- Swift: How to convert a String to UInt8 array?
- Spring MVC JSR 303 数据效验
- Real Time Messaging Protocol 学习
- Hadoop2.5.2+Sqoop-1.4.6(2.0以上的版本hadoop使用)伪分布式实现mysql数据上传到ndfs
- Python datetime模块
- 第四篇:赔率和盘口的特征之一
- SpringBoot自有Tomcat不同方式配置
- python发送各类邮件的主要方法
- 刚入行想做一名程序员
- Retrofit2.0-demo
- vim配置及插件安装管理(超级详细)
- 【厚积薄发】你应该知道的AssetBundle管理机制
- FEA从入门到精通系列 | 文本数据源加载与存储