Python 入门教程 4 ---- Date and Time
来源:互联网 发布:windows asp.net 编辑:程序博客网 时间:2024/05/22 07:47
第一节
1 介绍得到当前的时间datetime.now()
2 练习
1 设置变量now的值为datetime.now()
2 打印now的值
from datetime import datetimenow = datetime.now()print now
第二节
1 介绍从datetime.now得到的信息中提取出year,month等
2 练习: 从datetime.now中得到的信息中提取出year,month,day
from datetime import datetimenow = datetime.now()print now.monthprint now.dayprint now.year
第三节
1 介绍把输出日期的格式转化为mm//dd//yyyy,我们利用的是+来转化
2 练习:打印当前的日期的格式为mm//dd//yyyy
from datetime import datetimenow = datetime.now()print str(now.month)+"/"+str(now.day)+"/"+str(now.year)
第四节
1 介绍把输出的时间格式化为hh:mm:ss
2 练习:打印当前的时间的格式为hh:mm:ss
from datetime import datetimenow = datetime.now()print str(now.hour)+":"+str(now.minute)+":"+str(now.second)
第五节
1 练习:把日期和时间两个连接起来输出
from datetime import datetimenow = datetime.now()print str(now.month) + "/" + str(now.day) + "/" + str(now.year) + " "\+str(now.hour) + ":" + str(now.minute) + ":" + str(now.second)
- Python 入门教程 4 ---- Date and Time
- Date and Time Representation in Python
- Date and Time Representation in Python
- CodeCademy | Python | 4. Date and Time
- Python学习——Date and Time
- PHP date and time
- Formatting Date and Time
- Date and Time
- Date and Time
- date and time
- C++ time and date
- python datetime、time、date
- Python Date & Time
- python date time
- Formatting Time and Date: The Time and Date Format Suffixes
- Function modules: Date and Time
- Date and Time in ADF
- [Linux]Date and Time Commands
- EA---导出代码
- 如何使自己变得优雅
- HDFS datanode源码分析
- TCP/IP笔记 四.应用层(1)——DNS
- jQuery插件开发全解析
- Python 入门教程 4 ---- Date and Time
- COCOS2D #error "Cannot recognize the target platform; are you targeting an unsupported platform?"
- 单高斯背景建模
- JDBC连接常用数据库 基本的CURD
- 一些UINavigationController 跳转的神奇效果
- 为程序员量身定制的12个目标
- phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接。
- 0916
- MySql 的批量操作,要加rewriteBatchedStatements参数