hs-schedule.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:hacker-scripts 作者: areebbeigh 项目源码 文件源码
def is_valid_date(given_date):
    """
    Given a date string this function checks if the date is in the future
    """

    given_date = given_date.split("/")
    current_date = get_current_date().split("/")

    given_day = int(given_date[1])
    given_month = int(given_date[0])
    given_year = int(given_date[2])

    current_day = int(current_date[1])
    current_month = int(current_date[0])
    current_year = int(current_date[2])

    try:
        calendar.weekday(given_year, given_month, given_day)
    except ValueError:
        return False

    return (
        (given_year == current_year and given_month == current_month and given_day > current_day) or
        (given_year == current_year and given_month > current_month) or
        (given_year > current_year))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号