Dates and times

Objectives

  • Use the JavaScript Date object to get and manipulate dates
  • Use functions in JavaScript to format dates and times
  • Use a custom library (dateformat.js)
  • Use JavaScript to dynamically change a web page

Overview

This assignment is to create a page with dynamic content based upon the date and time.

Example of finished assignment

Program Specifications

  • ALL dates and times are required to be created as JavaScript Date objects.
  • Create a page which will format and display four dates as shown in the sample output.
  • Use the dateformat.js library to make formatting the dates easier.
  • The page should display a greeting which changes depending on whether it is morning (4am-noon), afternoon (noon-6pm), or evening (6pm-4am) when the page is loaded.
  • Create a Date object with the current date and time and then display it formatted as shown on the sample.
  • Create a Date object with a date that is important to you (other than your birthday), and then display it formatted as shown on the sample.
  • Create a Date object with your birthday and then display it formatted as shown on the sample.
  • Create a Date object with the web page's last modification date and time and then display it formatted as shown on the sample.

Grading rubric

  • 5 pts: The page has proper documentation comments and follows current standards.
  • 6 pts: The greeting works properly and changes depending upon the time of day the page is loaded.
  • 6 pts: The display for the current date and time works properly and is formatted as shown in the sample output.
  • 6 pts: The display for the important date works properly and is formatted as shown in the sample output.
  • 6 pts: The display for your birthday works properly and is formatted as shown in the sample output.
  • 6 pts: The display for the last modification date and time works properly and is formatted as shown in the sample output.
  • 5 pts: The dateformat.js library is included and used properly.