python 示例_带有示例的Python date isocalendar()方法
python 示例
Python date.isocalendar()方法 (Python date.isocalendar() Method)
date.isocalendar() method is used to manipulate objects of date class of module datetime.
date.isocalendar()方法用于操作模块datetime的日期类的对象。
It uses a date class object and returns a 3-tuple (ISO year, ISO week number, ISO weekday).
它使用日期类对象并返回一个三元组(ISO年,ISO周号,ISO周日)。
Most of the date and time calendar follow the Gregorian calendar. The ISO calendar is a widely used variant of the Gregorian one. The ISO year consists of 52 or 53 full weeks, and where a week starts on a Monday and ends on a Sunday. The first week of an ISO year is the first (Gregorian) calendar week of a year containing a Thursday. This is called week number 1, and the ISO year of that Thursday is the same as its Gregorian year.
For example, 2004 begins on a Thursday, so the first week of ISO year 2004 begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan 2004:
大多数日期和时间日历都遵循公历。 ISO日历是公历之一的广泛使用的变体。 ISO年度包括52或53个整周,其中一个星期从星期一开始,在星期日结束。 ISO年的第一周是包含星期四的一年中的第一个(格里高利历)日历周。 这称为第1周,该周四的ISO年与其公历年相同。
例如,2004年从星期四开始,因此ISO 2004年的第一周从2003年12月29日星期一开始,到2004年1月4日星期日结束:
Weekday number for Monday is 1 while incrementing by 1 for the coming days.
星期一的工作日数为1,而接下来的几天则增加1。
Module:
模块:
import datetime
Class:
类:
from datetime import date
Syntax:
句法:
isocalendar()
Parameter(s):
参数:
None
没有
Return value:
返回值:
The return type of this method is a tuple which tells us what is the ISO year, ISO week and the ISO weekday of that date.
此方法的返回类型是一个元组,它告诉我们什么是ISO年,ISO周和该日期的ISO工作日。
Example:
例:
## importing date class
from datetime import date
## Creating an instance
x = date.today()
d = x.isocalendar()
print("Original date:",x)
print("Today's date in isocalendar is:", d)
print()
x = date(2020, 1, 1)
d = x.isocalendar()
print("Date ", x,"in isocalendar is:", d)
print()
x = date(2020, 10, 27)
d = x.isocalendar()
print("Original date was:",x)
print("ISO year:",d[0],"ISO week:",d[1],"ISO weekday:",d[2])
Output
输出量
Original date: 2020-04-29
Today's date in isocalendar is: (2020, 18, 3)
Date 2020-01-01 in isocalendar is: (2020, 1, 3)
Original date was: 2020-10-27
ISO year: 2020 ISO week: 44 ISO weekday: 2
翻译自: https://www.includehelp.com/python/date-isocalendar-method-with-example.aspx
python 示例
python 示例_带有示例的Python date isocalendar()方法相关推荐
- lock_sh 示例_带有示例的Python date __str __()方法
lock_sh 示例 Python date .__ str __()方法 (Python date.__str__() Method) date.__str__() method is used t ...
- python 示例_带有示例的Python date timetuple()方法
python 示例 Python date.timetuple()方法 (Python date.timetuple() Method) date.timetuple() method is used ...
- python示例_带有示例的Python功能指南
python示例 Python函数简介 (Introduction to Functions in Python) A function allows you to define a reusable ...
- python 示例_带有示例的Python File write()方法
python 示例 文件write()方法 (File write() Method) write() method is an inbuilt method in Python, it is use ...
- python 示例_带有示例的Python文件关闭属性
python 示例 文件关闭属性 (File closed Property) closed Property is an inbuilt property of File object (IO ob ...
- python 示例_带有示例的Python字典update()方法
python 示例 字典update()方法 (Dictionary update() Method) update() method is used to update the dictionary ...
- python 示例_带有示例的Python字典popitem()方法
python 示例 字典popitem()方法 (Dictionary popitem() Method) popitem() method is used to remove random/last ...
- python 示例_带有示例的Python File close()方法
python 示例 文件close()方法 (File close() Method) close() method is an inbuilt method in Python, it is use ...
- python 示例_带有示例的Python列表remove()方法
python 示例 列出remove()方法 (List remove() Method) remove() method is used to remove the first occurrence ...
最新文章
- vivo 互联网业务就近路由技术实战
- oracle 关系 表 视图_oracle动态视图v$,v_$,gv$,gv_$与x$之间的关系
- Java单元测试-快速上手Junit
- 【Android基础】 Launch Mode
- C++和服务器交互的几个文件代码
- jfinal连接mysql数据库_JFinal中怎么获得当前数据库连接的数据库类型?
- eclipse中junit_在Eclipse中有效使用JUnit
- 1051 复数乘法(PAT乙级 C++)
- 如何快速实现精准的个性化搜索服务
- ubuntu 10.04 install vbox site
- HDU2024 C语言合法标识符【入门】
- 自定义 Dialog --- 仿照微信删除联系人界面
- FIR 带通滤波器参数设计流程
- 微信公众号推送模板消息(二):Access_token的获取
- Fastjson存在0day漏洞
- MATLAB 插值放大
- C++内存分配(operator new)
- 常用的计算机病毒检测方法有哪些,计算机病毒检测方法有哪些呢
- 【附源码】国内首届Discord场景创意编程开源项目
- 目标检测(六):DSSD