<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Mobile-Web-App: Javascript Exercise - Date</title> <script> function test(){ var date = new Date(); info = "<p> date: " + date + "</p>" + "<p> date.getFullYear(): " + date.getFullYear() + "</p>" + "<p> date.getMonth() 0-11: " + date.getMonth() + "</p>" + "<p> date.getDate() 1-31: " + date.getDate() + "</p>" + "<p> date.getDay() 0-6: " + date.getDay() + "</p>" + "<p> date.getHours() 0-23: " + date.getHours() + "</p>" + "<p> date.getMinutes() 0-59: " + date.getMinutes() + "</p>" + "<p> date.getSeconds() 0-59: " + date.getSeconds() + "</p>" + "<p> date.getMilliseconds() 0-999: " + date.getMilliseconds() + "</p>"; document.getElementById("prompt").innerHTML=info; } </script> </head> <body onload="test();"> <h1>Mobile-Web-App: Javascript Exercise - Date</h1> <div id="prompt"></div> </body> </html>
Monday, April 23, 2012
Javascript Exercise - Date object
Labels:
Fundamental.Javascript
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment