Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am writing VB DOT NET program just
6:15 am to 9:45 am it display "A-Shift"
12:15 pm to 2:30 pm it display "B-Shift"
7:00 pm to 10:00 pm it display "C-Shift"

when the button click it display the time base message

T/R
Posted
Comments
Pheonyx 25-Feb-14 7:21am    
What have you tried? Where are your code snippets to back up your question?
What do you want to do when the time is not in the given time slots?
Do you just want it to be triggered based on a button click?
Where are you stuck? What errors are you getting?
Don't just expect complete code solutions that is not how this site works.

1 solution

Try:
VB
Dim now As DateTime = DateTime.Now
Dim todayTime As TimeSpan = now - New DateTime(now.Year, now.Month, now.Day)
Dim band1Start As New TimeSpan(6, 15, 0)
Dim band1End As New TimeSpan(9, 45, 0)
If todayTime >= band1Start AndAlso todayTime <= band1End Then
	Console.WriteLine("A-Shift")
End If
And so on...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900