Javascript Date Formats

Javascript Date Formats 

We can use different method in date format.

var  newdate = new Date();

var  year = newdate.getFullYear();

year = year+1;

newdate.setYear(year);

alert(newDate);

Example of Javascript Date Formats

<html>
<head> <title>Date Example</title>
<script>
var test=new Date();
document.write(“The current date :”+ test+ “<br>”);
document.write(“Date.getDate():”+ test.getDate()+”<br>”);
document.write(“Date.getDay() : ” + test.getDay()+ “<br>”);
document.write(“Date.getFull Year : ” + test.getFullYear() +”<br>”);
document.write(“Date.getHours : ” + test.getHours() + “<br>”);
document.write(“Date.getMilliseconds : “+ test.getMilliseconds() + “<br>”);
document.write(“Date.getMinutes : ” + test.getMinutes()+”<br>”);
document.write(“Date.getMonth :” +test.getMonth() +”<br>”);
document.write(“Date.getSeconds : “+ test.getSeconds()+ “<br>”);
document.write(“Date.getTime : ” + test.getTime() +”<br>”);
document.write(“Date.getTimezoneOffset() : ” + test.getTimezoneOffset() +”<br>”);
document.write(“Date.getYear() : ” + test.getYear()+ “<br>”);
</script>
</head>
<body>
<p> Date with different format </p>
</body>
</html>




Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top