&n"/>
Home >Web Front-end >HTML Tutorial >How to return the 'time' part of a date as a 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 the Date object in human-readable form.
You need to run the following code to return only the time portion of the 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>
The above is the detailed content of How to return the 'time' part of a date as a readable string. For more information, please follow other related articles on the PHP Chinese website!