My goal is to display a string or image on a ASP.NET webpage only during a predefined date and time (Monday through Friday, 9:00AM-5:00PM). Keep in mind, I will be relying on fixed server time, PST.

I am not sure whether to use jQuery, JavaScript, C# or PHP for the script.
Here is what I have come up with so far in JavaScript. Am I on the right path?

```
<script type="text/javascript" language="javascript">
function GetDateTime()
{
var d = new Date();
var day = d.getDay(); //returns 0-6 corresponding to Sunday through Saturday
var hour = d.getHours(); //returns 0-23 corresponding to hours 
}   
</script>

```

Now I need help manipulating the variables 'day' and 'hour'. I came up with a generic algorithm to specify Monday through Friday, 9:00AM - 5:00PM as follows:

```
if ((day>0 && day<6) && (hour>8 && hour<18) ) //days 1 through 5 (M-F) and (hours 9:00-17:00)
{ alert("testing") 
//This is for testing purposes. I will eventually insert code here to display string or image perhaps? 
}

```

Assuming the date and time are properly obtained and the if statement algorithm is correct, how do I implement the Javascript portion and "tie the code together" with my ASP.NET page to display a string or image based on those parameters?

This is my first time posting on Stackoverflow. I hope I am addressing this question properly and clearly enogh. Thanks in advance for any help.

---

**Edit:** I gave up on JavaScript for now. C# seems to me like the proper way of doing this. Thanks to **codingbiz** 's resonse, I was able to implement the script as shown below:

```
<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
    DateTime thisTime = DateTime.Now;           // retrieve date and time
    string day = thisTime.DayOfWeek.ToString(); // declare and define day to string 
    int hour = thisTime.Hour;                   // declare and define hour to int

//check if string contains the following: "Monday,Tuesday,Wednesday,Thursay,Friday"
if ("Monday,Tuesday,Wednesday,Thursay,Friday".IndexOf(day) > -1 && hour >= 9 && hour <= 17)
{
   conditionalLabel.Text = "<img src='sony_frontex3_repair.jpg' />";
}
}
</script>

```

I also added the following conditional label to the body of the content page and master page:

**New question:**
Lets say a user visits my website at 4:45PM and the image/string displays as intended. Some time goes by and it is now 5:05. Will the image/string automatically disappear, or only after the page is closed, then reopened? Will cookies or cache affect the performance of this script? Is there any such issues I need to address, such as specifying in the code to automatically refresh the page?