• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 8. Making Your Pages Dynamic > Putting the Current Date into a Web Page

Putting the Current Date into a Web Page

JavaScript can determine the current date and time from your computer (which it gets as a number), and then manipulate that figure in many ways. Your script has to handle the conversion from a number into a textual date, however. Script 8.1 shows how to get the current date, convert it from a number into a standard date, and then write the result to a document window. Note that Script 8.1 actually contains two scripts, one in the head of the HTML document (the header script), and the other in the body of the document (unsurprisingly, we call it the body script).

Script 8.1. This script is actually made up of two short scripts, and writes the current date to the document window.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint