toTimeString()

Introduction

The toTimeString() method Converts the time portion of a Date object to a string. The following is the syntax for the toTimeString() method.

obj.toTimeString();

Example

The following is the code for the toTimeString() method.

var obj = new Date(); document.write(obj.toTimeString());

On running the above code, the following output is obtained.