SyntaxFix
Write A Post
Hire A Developer
Questions
Take a look at the facilities provided by the time module
time
You have several conversion functions there.
Edit: see the datetime module for more OOP-like solutions. The time library linked above is kinda imperative.
datetime