Sponsored Ad

Wednesday, March 10, 2010

JavaScript Date Functions - Get Date, Month and Year , Get Hours, Minutes and Seconds

Here is sample code to use JavaScript inbuilt date functions. This sample includes functions for:

getDate()

getMonth()

getFullYear()

getHours()

getMinutes()

getSeconds()

 

To use these function first need to create a date variable and then call functions.

 

Get Date, Month and Year

<html>

<body>

<script type="text/javascript">

var d = new Date()

document.write(d.getDate())

document.write(".")

document.write(d.getMonth() + 1)

document.write(".")

document.write(d.getFullYear())

document.write(".")

document.write(d.getHours())

document.write(".")

document.write(d.getMinutes())

document.write(".")

document.write(d.getSeconds())

</script>

</body>

</html>

 

0 comments:

Post a Comment

Sponsored Ad

More Related Articles

Website Update

Followers