SQL PHP HTML ASP JavaScript articles and free scripts to download
 

toString()

Before applying any string functions to the date object we must convert it to string by using toString function.

Date.toString();

Sample code

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

The output is here

After conversion to string we can apply any string function like this .

document.write(dt.toString().substr(5));




Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked

Join Our Email List
Email:  
For Email Newsletters you can trust
Date & Time