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