Thursday, June 04, 2015

Time Span Check for Store Hours to show... Using a .NET Literal Control

I have done this countless times, but senior moments are happening.

Const timeHourOpen As Integer = 8
Const timeHourClosed As Integer = 16 'Set one hour less because at 5:00 the store will close

If (timeHourOpen <= DateTime.Now.Hour AndAlso DateTime.Now.Hour <= timeHourClosed) Then
   'Account for greater than 17 hundred hours aka 17:01
                            callCenterOpen.Visible = True
                        Else
                            callCenterOpen.Visible = False
                        End If


That is all for today....

Now I will always refer back to the My Blog to review...

I like how the conditional logic is written

LowerBound <= Value <= Upper Bound

AndAlso for short circuiting

Till Next Post.

No comments:

CSS Basics That Make Your Site Look Professional

CSS Basics That Make Your Site Look Professional Understanding the Role of CSS in Web Design What CSS Does for Website Appearance C...