Python基础学习小记——时间日历

Python程序能够用很多方式处理日期和时间,转换时间格式是一个常见的功能。

1、time模块

提供了处理时间和表示之间转换的功能

①获取当前时间戳

时间戳

(1)概念:从0时区的1970年1月1日0时0分0秒,到所给定日期时间的秒数。是一个浮点数

(2)获取方式:import time

                      time.time()

②获取时间元组


  

③获取格式化的时间:将时间戳(秒)->格式化时间

④格式化日期字符串

⑤休眠n秒

2、calendar模块

提供与日历相关的功能,比如:为给定的月份或者年份打印文本日历的功能(仅作了解)

3、datetime模块

相关推荐

  1. Python 日期时间

    2024-02-02 15:10:02       32 阅读
  2. python时间日期

    2024-02-02 15:10:02       29 阅读
  3. 计算 日期增加小时时间

    2024-02-02 15:10:02       52 阅读
  4. Python日期时间详解

    2024-02-02 15:10:02       59 阅读
  5. Python: 日期时间格式化

    2024-02-02 15:10:02       32 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-02-02 15:10:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-02-02 15:10:02       106 阅读
  3. 在Django里面运行非项目文件

    2024-02-02 15:10:02       87 阅读
  4. Python语言-面向对象

    2024-02-02 15:10:02       96 阅读

热门阅读

  1. Nginx限流配置详解

    2024-02-02 15:10:02       37 阅读
  2. Unity3D 法向量和法线详解

    2024-02-02 15:10:02       55 阅读
  3. react实现组件通信的案例

    2024-02-02 15:10:02       47 阅读