I have this string:
'2012-02-10' # (year-month-day)
and I need it to be as date type for me to use the date function isoweekday().
Does anyone know how I can convert this string into a date?
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.
You can do that with
datetime.strptime()Example:
You can find the table with all the
strptimedirective here.To increment by 2 days if
.isweekday() == 6, you can usetimedelta():