when I input python code:
today=datetime.datetime.now()
toda
today.weekday(),
Result is:
datetime.datetime(2012, 9, 18, 16, 53, 35, 124836)
1
But, should it be 2? Anything wrong or my mistake?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, today is Tuesday, and that’s weekday 1, following the documentation:
So Monday is
0, Tuesday is1, etc.If you want
2for Tuesday, use.isoweekday()instead: