JavaScript: Displaying Date and Time

Posted on September 23, 2007 at 16:19 JavaScript

Our first exercise in CMSC 140. I was, by any luck, able to do it without any help from my classmates and, as a matter of fact, even enjoyed doing it! 😉

P.S. Also prints out “Hello World!” n times, where n is the date.


<script type="text/javascript">
   var nelson = new Date();
   var date = nelson.getDate();
   var day = nelson.getDay();
   var month = nelson.getMonth();
   var fullYear = nelson.getFullYear();
   var hours = nelson.getHours();
   var minutes = nelson.getMinutes();

1 Comment

  1. amir
    September 25, 2007 at 09:37

    hmmmmm … long java scrpt ha… mdu naa gyud kaparha ang mga langauge noh… lahi lng sa pgdeclare…hehehehehehe wla lng


Say What?

Website: (optional)