
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How to convert unix timestamp string to readable date in Python?
You can use the fromtimestamp function from the datetime module to get a date from a UNIX timestamp. This function takes the timestamp as input and returns the datetime object corresponding to the timestamp.
Exmaple
import datetime timestamp = datetime.datetime.fromtimestamp(1500000000) print(timestamp.strftime('%Y-%m-%d %H:%M:%S'))
Output
This will give the output −
2017-07-14 08:10:00
- Related Articles
- How to convert Python date to Unix timestamp?
- Convert UNIX timestamp into human readable format in MySQL?
- Convert date string to timestamp in Python
- Convert MySQL Unix-Timestamp format to date format?
- Convert MySQL timestamp to UNIX Timestamp?
- How to convert from Unix timestamp to MySQL timestamp value?
- Convert dd/mm/yyyy string to Unix timestamp in MySQL?
- How to convert MySQL datetime to Unix timestamp?
- How to convert a Unix timestamp to time in JavaScript?
- How to convert date to timestamp in MongoDB
- MySQL - Convert YYYY-MM-DD to UNIX timestamp
- How to convert timestamp string to datetime object in Python?
- Convert MM/DD/YY to Unix timestamp in MySQL?
- Convert buffer to readable string in JavaScript?
- Java Program to convert millisecond to readable string

Advertisements