<!--

// Demonstrates the typical format for date and time info derived form date()

// Create a varible with the current data info

var right_now=new Date();



// Month always comes through as one numeric

// Less than the current month. Jan=0 Feb=1 etc.

document.write(right_now.getMonth()+1);

document.write("/");



document.write(right_now.getDate());

document.write("/");



// Year can come as the current year

// or the number of years since 1900

// To account for this we check the value 



var right_year=right_now.getYear();

if (right_year < 2000) 

right_year = right_year + 1900; 

document.write( right_year );

document.write("&nbsp;");



// Begin Ouptut of Time



// Hours come in military time

// To put in civilian time you must check the hours

// To see if they're greater than 12

var right_hours=right_now.getHours()

if (right_hours > 12) 

right_hours = right_hours - 12; 

document.write(right_hours);

document.write(":");



// To display leading zeros before the minutes

// Check for minutes less then 10

var right_min=right_now.getMinutes();

if (right_min < 10)

document.write("0");

document.write(right_min);

document.write(":");



// To display leading zeros before the seconds

// Check for minutes less then 10

var right_sec=right_now.getSeconds();

if (right_sec < 10)

document.write("0");

document.write(right_sec);



// To display AM or PM assign a varible to A.M. Value

// If the the hours are greater than 12 then switch

// the value to P.M.

var ampm=" A.M.";

if (right_now.getHours() > 12)

ampm=" P.M.";

document.write(ampm);



// -->