How come this works:
import datetime
now = datetime.datetime.now()
month = '%d' % now.month
print month
But this doesn’t?
import datetime
now = datetime.datetime.now()
month = '%m' % now.month
print month
Thanks!
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.
%m is not a supported format character for the % operator. Here is the list of supported formating characters for this operator
%m is valid when your are using strftime function to build a date string