

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to convert a Unix timestamp to time in JavaScript?
To convert a Unix timestamp to time, you can try to run the following code in JavaScript −
Example
<html> <head> <title>JavaScript Dates</title> </head> <body> <script> var unix_time = 1514791901 ; var date = new Date(unix_time*1000); // get hours var hrs = date.getHours(); // get minutes var min = "0" + date.getMinutes(); // get seconds var sec = "0" + date.getSeconds(); document.write("Time- "+hrs + ":" + min.substr(-2) + ":" + sec.substr(-2)); </script> </body> </html>
Output
Time- 13:01:41
- Related Questions & Answers
- Convert MySQL timestamp to UNIX Timestamp?
- How to convert from Unix timestamp to MySQL timestamp value?
- How to convert MySQL datetime to Unix timestamp?
- How to convert Python date to Unix timestamp?
- Convert MySQL Unix-Timestamp format to date format?
- MySQL - Convert YYYY-MM-DD to UNIX timestamp
- How to convert unix timestamp string to readable date in Python?
- Convert MM/DD/YY to Unix timestamp in MySQL?
- How to convert a datetime string to millisecond UNIX time stamp?
- Convert dd/mm/yyyy string to Unix timestamp in MySQL?
- How to get the Unix timestamp in C#
- Convert UNIX timestamp into human readable format in MySQL?
- Python Pandas - Convert Timestamp to another time zone
- PHP program to convert a given timestamp into time ago
- Python Pandas - Convert naive Timestamp to local time zone
Advertisements