- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 return the "time" portion of the Date as a human-readable string.
To return the “time” portion of the Date as a human-readable string, use the toTimeString() method in JavaScript. This method returns the time portion of a Date object in the human-readable form.
Example
You need to run the following code to return only the time portion of a Date −
<html> <head> <title>JavaScript toTimeString Method</title> </head> <body> <script> var dateobject = new Date(2018, 0, 1, 14, 39, 7); document.write( dateobject.toTimeString() ); </script> </body> </html>
Advertisements