Date Setter

 

<html>
<head>
    <title>the date</title>
</head>
<body>
    <script type="text/javascript">
      var myDate = new Date();

      myDate.setDate(12);
      myDate.setFullYear(2012);
      myDate.setHours(3);
      myDate.setMilliseconds(123);
      myDate.setMinutes(12);
      myDate.setMonth(2);
      myDate.setSeconds(21);
      myDate.setTime(123);
      myDate.setUTCDate(23);
      myDate.setUTCFullYear(2012);
      myDate.setUTCHours(1);
      myDate.setUTCMilliseconds(12);
      myDate.setUTCMinutes(21);
      myDate.setUTCMonth(01);
      myDate.setUTCSeconds(12);


      document.writeln(myDate.getDate());
      document.writeln(myDate.getDay());
      document.writeln(myDate.getFullYear());
      document.writeln(myDate.getHours());
      document.writeln(myDate.getMilliseconds());
      document.writeln(myDate.getMinutes());
      document.writeln(myDate.getMonth());
      document.writeln(myDate.getSeconds());
      document.writeln(myDate.getTime());
      document.writeln(myDate.getTimezoneOffset());
      document.writeln(myDate.getUTCDate());
      document.writeln(myDate.getUTCDay());
      document.writeln(myDate.getUTCFullYear());
      document.writeln(myDate.getUTCHours());
      document.writeln(myDate.getUTCMilliseconds());
      document.writeln(myDate.getUTCMinutes());
      document.writeln(myDate.getUTCMonth());
      document.writeln(myDate.getUTCSeconds());
    </script>
</body>
</html>

  
Click to view the demo
Home 
  JavaScript Book 
    Essential Types  

Date:
  1. Date Type
  2. Date getter
  3. Date Setter
  4. Date.parse()
  5. Date.UTC()
  6. Date.now()
  7. Date toLocaleString()
  8. Date toString()
  9. Date valueOf()
  10. Date toDateString()
  11. Date toTimeString()
  12. Date toLocaleDateString()
  13. Date toLocaleTimeString()
  14. Date toUTCString()