Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.14 计算当前月份日期范围 例子不符合预期 #343

Open
fengtangzheng opened this issue Feb 19, 2021 · 1 comment
Open

3.14 计算当前月份日期范围 例子不符合预期 #343

fengtangzheng opened this issue Feb 19, 2021 · 1 comment

Comments

@fengtangzheng
Copy link

def get_month_range(start_date=None):
    if start_date is None:
        start_date = date.today().replace(day=1)
    _, days_in_month = calendar.monthrange(start_date.year, start_date.month)
    end_date = start_date + timedelta(days=days_in_month)
    return (start_date, end_date)
def get_month_range(start_date=None):
    if start_date is None:
        start_date = date.today()
    start_date = start_date.replace(day=1)
    _, days_in_month = calendar.monthrange(start_date.year, start_date.month)
    end_date = start_date + timedelta(days=days_in_month)
    return (start_date, end_date)
@zlu27
Copy link
Contributor

zlu27 commented Feb 20, 2021

可以说一下不符合预期的结果吗。我这里试了一下没什么问题,Python 3.8.6 (32-bit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants