Friday, December 19, 2008

Closing your app during a certain time range

Here is how you check a time range. Example, say you want your webpage to be closed during certain times of the night...

I got it at some forum, but honestly, It should be more straight forward.

Dim StartDateTime As DateTime = DateTime.Parse("3:00:00 AM")
Dim EndDateTime As DateTime = DateTime.Parse("4:30:00 AM")

If (DateTime.Now.CompareTo(StartDateTime) >= 0 AndAlso DateTime.Now.CompareTo(EndDateTime) <= 0) Then Response.Redirect("maintn.aspx") End If

No comments:

Post a Comment