Solved

check time

Posted on 2013-06-26
5
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

734 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