Sometimes self.start is unicode:
eg.
>>>self.start u'07:30:00'
Which makes datetime.combine complain
start = datetime.combine(self.job_record.date, self.start)
How does one:
- Test for unicode?
- Convert from u’07:30:00′ to datetime.time?
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.
datetime.combineis complaining because it expects the second argument to be adatetime.timeinstance, not a string (or unicode string).There are a few ways to convert your string to a
datetime.timeinstance. One way would be to usedatetime.strptime: