Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Datetime interval checker - ASP.NET, VB.NET

Its simple snap of code that i think that could be useful. Hope it will help you someway.

   Dim upperDate As Date = "#30/6/" & DateTime.Now.Year & "#"
        Dim lowerDate As Date = "#1/6/" & DateTime.Now.Year & "#"

        If Not (Date.Compare(Date.Today, upperDate) < 0 And Date.Compare(Date.Today, lowerDate) > 0) = True Then
            Response.Redirect(http://www.snb-bg.com) ' Do something if not between 1.6.2009 and 30.6.2009
        End If

Cheers

No Comments