Python: Convert a given time in seconds since the epoch to a string representing local time
Python Datetime: Exercise-59 with Solution
Write a Python program to convert a given time in seconds since the epoch to a string representing local time.
import time print(time.ctime()) print(time.ctime(236543789))
Tue Apr 13 11:51:51 2021 Thu Jun 30 18:36:29 1977
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 that can suspend execution of a given script a given number of seconds.
Next: Write a Python program to print simple format of time, full names and the representation format and preferred date time format.
What is the difficulty level of this exercise?
Test your Python skills with w3resource's quiz
Python: Tips of the Day
Free up Memory:
- Manual garbage collection can be performed on timely or event based mechanism.
import gc collected_objects = gc.collect()
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework