Solved

check time

Posted on 2013-06-26
5
254 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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 aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

765 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