Latest

recent

JavaScript toString() Method

Definition and Usage

The toString() method converts a Date object to a string and returns the result.

Syntax

dateObject.toString()


Example

In this example we will convert today's date to a string:

<script type="text/javascript">
var d = new Date();
document.write (d.toString());
</script>

The output of the code above will be:

Fri May 11 2012 14:38:06 GMT+0530 (India Standard Time)

JavaScript toString() Method Reviewed by 1000sourcecodes on 02:46 Rating: 5
Powered by Blogger.