Solved

check time

Posted on 2013-06-26
5
252 Views
Last Modified: 2013-06-27
How can I check if the time is past 4:40pm?

if Datetime.now.hour > 4 and datetime.now.minute>=40  ?
0
Comment
Question by:VBdotnet2005
  • 2
  • 2
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39280041
if Datetime.now.hour >= 16 and datetime.now.minute>=40

Open in new window

0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 250 total points
ID: 39280146
Also :

If Now.TimeOfDay > New TimeSpan(16, 40, 0) Then
0
 

Author Comment

by:VBdotnet2005
ID: 39282030
Is this right?
if Datetime.now.hour >= 16 and datetime.now.minute>=40

what if the hr is 20 and min is 30?

Datetime.now.hour >= 16  would be true and datetime.now.minute>=40 would be false.

I just want to know if the time has past 16:40.
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 250 total points
ID: 39282174
Ah. Good point. James' suggestion would probably be better (in terms of succinctness), but to correct:

if (Datetime.now.hour >= 16 andalso datetime.now.minute>=40) OrElse DateTime.Now.Hour > 16 Then

Open in new window

0
 

Author Closing Comment

by:VBdotnet2005
ID: 39282223
Thank you again
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question