Use datetime
module:
from datetime import datetime
ts = int('1284101485')
# if you encounter a "year is out of range" error the timestamp
# may be in milliseconds, try `ts /= 1000` in that case
print(datetime.utcfromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S'))
More Related Contents:
- How to change the datetime format in Pandas
- Convert python datetime to epoch with strftime
- Python Create unix timestamp five minutes in the future
- What exactly does the T and Z mean in timestamp?
- Why does “%-d”, or “%-e” remove the leading space or zero?
- How to calculate number of days between two given dates
- How to subtract a day from a date?
- What is the standard way to add N seconds to datetime.time in Python?
- Convert Excel style date with pandas
- How do I get a value of datetime.today() in Python that is “timezone aware”?
- How do I find the time difference between two datetime objects in python?
- Convert unix time to readable date in pandas dataframe
- Best way to find the months between two dates
- How to convert columns into one datetime column in pandas?
- How to convert a timezone aware string to datetime in Python without dateutil?
- pandas out of bounds nanosecond timestamp after offset rollforward plus adding a month offset
- Create a day-of-week column in a Pandas dataframe using Python
- Python datetime object show wrong timezone offset
- Convert timedelta to total seconds
- Python datetime formatting without zero-padding
- How can I convert 24 hour time to 12 hour time?
- Converting between datetime and Pandas Timestamp objects
- unexpected results converting timezones in python
- parameter unsupported when inserting int in sqlite
- Using %f with strftime() in Python to get microseconds
- How to monkeypatch python’s datetime.datetime.now with py.test?
- How to get the seconds since epoch from the time + date output of gmtime()?
- Parsing a date that can be in several formats in python
- Convert a column of timestamps into periods in pandas
- Python generating a list of dates between two dates