Date Methods In Javascript

In this article i explain you javascript date functions
1.getDate()         :-      Get the day as a number
1.getFullYear()    :-     Get the year
2.getMonth()      :-      Get  the month
3.getDay()          :-      Get the week day as a number
4.getHourrs()     :-       Get the hour
5.getMinutes()    :-      Get the minutes
6.getTime()         :-      Get the time
7.getSeconds()   :-      Get the seconds
8.getmilliSeconds():-   Get the milli seconds

Example:-
  <script type="text/javascript">
        var d = new Date();
        document.write("current year     :- " + d.getFullYear() + "<br/>");
        document.write("current month  :- " + d.getMonth() + "<br/>");
        document.write("current day     :- " + d.getDay() + "<br/>");
        document.write("current hours  :-" + d.getHours() + "<br/>");
        document.write("current minuts  :- " + d.getMinutes() + "<br/>");
        var date = new Date(2016, 7, 13, 11, 10, 10, 0)
        document.write("date formate " +date +"<br/>")

    </script>


No comments:

Post a Comment