python类weekday()的实例源码

timeseries.py 文件源码 项目:Thymus-timeseries 作者: sidorof 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def convert(self, new_freq, include_partial=True, **kwargs):
        """
        This function returns the timeseries converted to another frequency,
        such as daily to monthly.

        Usage:
            convert(new_freq, include_partial=True, **kwargs)

        The only kwarg is
            weekday=<some value>

        This is used when converting to weekly data. The weekday number
        corresponds to the the datetime.weekday() function.
        """
        if new_freq not in FREQ_IDAYTYPES + FREQ_DAYTYPES:
            raise ValueError(
                "Invalid new frequency: %s" % new_freq)

        return convert(
            self, new_freq, include_partial=include_partial, **kwargs)
managers.py 文件源码 项目:HongikFood 作者: JungWinter 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def calcWday(self, isToday):
        wday = datetime.weekday(datetime.utcnow() + timedelta(hours=9))
        if not isToday:
            wday = (wday + 1) % 7
        return wday
unison.py 文件源码 项目:nyx 作者: Cappycot 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def is_day(string):
    val = 1
    for day in days:
        if day in string:
            return val
        val += 1
    if "today" in string:
        return datetime.now().weekday() + 1
    return -1
unison.py 文件源码 项目:nyx 作者: Cappycot 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def time_stamp(datetime):
    day = datetime.weekday() + 1
    hour = datetime.hour
    minute = datetime.minute
    return day * 10000 + hour * 100 + minute
es_interface.py 文件源码 项目:ccdb5-api 作者: cfpb 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def _min_valid_time():
    # show notification starting fifth business day data has not been updated
    # M-Th, data needs to have been updated 6 days ago; F-S, preceding Monday
    now = _get_now()
    weekday = datetime.weekday(now)
    # When bigger than 3, it means it is a Friday/Saturday/Sunday,
    # we can use the weekday integer to get 4 days ago without the need to
    # worry about hitting the weekend.  Else we need to include the weekend
    delta = weekday if weekday > 3 else 6
    return (now - timedelta(delta)).strftime("%Y-%m-%d")


问题


面经


文章

微信
公众号

扫码关注公众号