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));
Your Rating





More on JavaScript Date & Time

Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer