A simple example In this example, we'll write a script that you can use to display the current date on your pages. In order to work with date other than current date and time, we must create a date object by specifying different parameters in the Date constructor. It's free to use as long as you give credit where credit is due. For example: The problem with using directly is that it's a mutator and that sort of thing is best avoided. We've also included a simple example to show how it all hangs together. The following example converts date string to DD-MM-YYYY format. Overload of Date constructor includes following seven numeric parameters. The desired interval can then be determined by dividing that number by the corresponding number of milliseconds.