We will be using built in Date object. We can create instances of this object and use in our script like this
To display the value we can use simple output command like this
The output will be like this Sat Jan 28 2012 10:17:04 GMT+0530 (India Standard Time)
Creating Date objectThis is the format to be used
Using button ClickNow this alert we will trigger when a button is clicked by a user. Here is onclick event of a button click.
Here is the demo, click this button
Here is the complete code for the page with Show Time button.
Showing DD/MM/YYYY format
This article is written by plus2net.com team.