-1

Possible Duplicate:
Convert string to datetime in django?

how to convert time string like '18:30:00' into datetime in python?

1
  • Is the "Django" tag here supposed to indicate that you're using Django (and hence any helper functions in Django are available), or that you specifically want an answer for Django templates? If the latter, this is a dupe, otherwise is isn't really, since Python is not the same language as Django templates. One of the answers over there uses a template filter, and the other one is Python but doesn't return a datetime, so I see why the questioner might want to ask another, similar question... Commented Apr 19, 2011 at 16:41

3 Answers 3

3

Use the datetime.datetime.strptime() method

Sign up to request clarification or add additional context in comments.

Comments

1

My post in Daniweb:
Date string to date object, seconds to readable string

You seem to only consider time part, it is trivial to convert by simple split.

Comments

0

http://docs.python.org/library/time.html#time.strptime

That is the best way to do it

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.