Python Exercises

Python Exercise: Convert unix timestamp string to readable date

Python datetime: Exercise-6 with Solution

Write a Python program to convert unix timestamp string to readable date.

Sample Solution:

Python Code:

import datetime
    ).strftime('%Y-%m-%d %H:%M:%S')

Sample Output:

2010-09-10 13:31:22 

Visualize Python code execution:

The following tool visualize what the computer is doing step-by-step as it executes the said program:

Python Code Editor:

Contribute your code and comments through Disqus.

Previous: Write a Python program to subtract five days from current date.
Next: Write a Python program to print yesterday, today, tomorrow.

What is the difficulty level of this exercise?

Many of our valued users post comments along with piece of code. Disqus may, false positively, consider those piece of code as Bad or Starnge syntax and send those comments to spam automatically. Even if that happens, we will make sure those useful comments are taken out of spam and approved. It may take a couple of days for that though, but any useful comment will be brought to public view for sure. We regret if that happend to any user. You may write us directly regarding this to - w3resource[at]yahoo[dot]com.