
- 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 an integer into a date object 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.
Example
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 a Python date string to a date object?
- How to convert a String into a Date object using JDBC API?
- How to convert an integer to a character in Python?
- How to convert a date object's content into json in JavaScript?
- How to convert Python DateTime string into integer milliseconds?
- How to convert an object array to an integer array in Java?
- How to convert a string vector into an integer vector in R?
- How to convert JSON data into a Python object?
- How to convert an object into an array in JavaScript?
- How to convert an integer to a unicode character in Python?
- How to convert an integer to a hexadecimal string in Python?
- How to convert an integer to a octal string in Python?
- How do I convert a string into an integer in JavaScript?
- How to convert a string into integer in JavaScript?
- How to convert a Date object to LocalDate object in java?

Advertisements