JavaScript Current Date Update in Browser?

I’ve implemented a script that shows the current time and date.
The issue is when the users browser windows remains open, the time does not update every 60 seconds on the minute change etc. Is there a way to have the time/script reload to reflect the current script or would this be better suited to something server side? Thank you so much!

<!–

var a_p = “”;
var d = new Date();
var curr_hour = d.getHours();
if (curr_hour < 12)
{
a_p = “AM”;
}
else
{
a_p = “PM”;
}
if (curr_hour == 0)
{
curr_hour = 12;
}
if (curr_hour > 12)
{
curr_hour = curr_hour - 12;
}

var curr_min = d.getMinutes();

curr_min = curr_min + “”;

if (curr_min.length == 1)
{
curr_min = “0” + curr_min;
}

document.write(curr_hour + " : " + curr_min + " " + a_p + " ");

//–>

<!–

var months = new Array(12);
months[0] = “January”;
months[1] = “February”;
months[2] = “March”;
months[3] = “April”;
months[4] = “May”;
months[5] = “June”;
months[6] = “July”;
months[7] = “August”;
months[8] = “September”;
months[9] = “October”;
months[10] = “November”;
months[11] = “December”;

var current_date = new Date();
month_value = current_date.getMonth();
day_value = current_date.getDate();
year_value = current_date.getFullYear();

document.write(“” + months[month_value] + " " +
day_value + ", " + year_value);

//–>

This is something that cannot be done server side - you can only do it with JavaScript.

It also cannot be done using document.write() as that only substitutes for server side code when you don’t have a server side language available.

You will need to either use the standard DOM calls to update the page content to change the time or use innerHTML.