本文整理汇总了Python中pycalendar.datetime.DateTime.getDay方法的典型用法代码示例。如果您正苦于以下问题:Python DateTime.getDay方法的具体用法?Python DateTime.getDay怎么用?Python DateTime.getDay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycalendar.datetime.DateTime
的用法示例。
在下文中一共展示了DateTime.getDay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getUntilDate
# 需要导入模块: from pycalendar.datetime import DateTime [as 别名]
# 或者: from pycalendar.datetime.DateTime import getDay [as 别名]
def getUntilDate(self):
if hasattr(self, "_cached_until"):
return self._cached_until
year = 9999
month = 12
day = 1
hours = 0
minutes = 0
seconds = 0
mode = None
if self.until and not self.until.startswith("#"):
splits = self.until.split(" ")
year = int(splits[0])
month = 1
day = 1
hours = 0
minutes = 0
seconds = 0
mode = None
if len(splits) > 1 and not splits[1].startswith("#"):
month = int(rule.Rule.MONTH_NAME_TO_POS[splits[1]])
if len(splits) > 2 and not splits[2].startswith("#"):
if splits[2] == "lastSun":
dt = DateTime(year=year, month=month, day=1)
dt.setDayOfWeekInMonth(-1, DateTime.SUNDAY)
splits[2] = dt.getDay()
elif splits[2] == "lastSat":
dt = DateTime(year=year, month=month, day=1)
dt.setDayOfWeekInMonth(-1, DateTime.SATURDAY)
splits[2] = dt.getDay()
elif splits[2] == "Sun>=1":
dt = DateTime(year=year, month=month, day=1)
dt.setDayOfWeekInMonth(1, DateTime.SUNDAY)
splits[2] = dt.getDay()
day = int(splits[2])
if len(splits) > 3 and not splits[3].startswith("#"):
splits = splits[3].split(":")
hours = int(splits[0])
minutes = int(splits[1][:2])
if len(splits[1]) > 2:
mode = splits[1][2:]
else:
mode = None
if len(splits) > 2:
seconds = int(splits[2])
dt = DateTime(year=year, month=month, day=day, hours=hours, minutes=minutes, seconds=seconds)
self._cached_until = utils.DateTime(dt, mode)
return self._cached_until