Solved

# check time

Posted on 2013-06-26
248 Views
How can I check if the time is past 4:40pm?

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

LVL 74

Expert Comment

``````if Datetime.now.hour >= 16 and datetime.now.minute>=40
``````
0

LVL 40

Accepted Solution

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

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

Author Comment

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 74

Assisted Solution

käµfm³d   👽 earned 250 total points
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
``````
0

Author Closing Comment

Thank you again
0

## Featured Post

### Suggested Solutions

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.