John Account
asked on
Asp.net 2.0 DateTime.Now event
I need help figuring out how to effectively use the DateTime.Now event in this circumstance: For my local churce, I will be streaming a live webcast starting at 10:30 every sunday morning. When a button for the Live Webcast is clicked, if the time is between 10:30 and 12:30, I want the click event to do something; if the time the button is clicked is not between 10:30 and 12:30 then do somethign else. Here's what I got so far, and I just don't think I got the right idea here. So, any help you can offer would be greatly appreciated. I'm doing this in VB, but I'll take any help you can offer--either in VB or C#. Thanks.
Protected Sub imgbtnWebcast_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgbtnWebcast.Click
If DateTime.Now.DayOfWeek = DayOfWeek.Wednesday Then
If DateTime.Now.Hour > 11 Then
'Do stuff here
End If
Else
'Do other stuff
End If
End Sub
ASKER
Nope, that didn't do anything.
It's not going to until Sunday at 10:30AM... :)
ASKER
ahem hem...the date and time is changed to the present, for testing purposes. Does not work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wow, thanks so much, GreymanMSC. That's a really awesome way of doing it.
ASKER
Awesomeness
ASKER
Oh...darn. One thing I forgot to mention, GreymanMSC: I need the time to be the time on the Server. Anyway to easily make this represent the time on the server?
ASKER
Oh...nevermind! I'm testing on my local machine; hence the time on my computer, lol. Duh. Sorry.
Open in new window