[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Difference in minutes between two dates

Posted on 2000-03-05
3
Medium Priority
?
159 Views
Last Modified: 2010-05-02
Let say i have a Date Variable declared as

CurrentTime as date

and i have string populated with this

oldtime=now

how can i check to see if the difference in minutes bewtween old time and current time is more than 30 minutes. i tried saying

if currenttime-cdate(oldtime)<30 then
...
but of course that was wrong...

thankyou
Jon Hess
0
Comment
Question by:jonjhess
  • 2
3 Comments
 

Author Comment

by:jonjhess
ID: 2586194
Well that was full of errors.. it should be > but i'm sure that you see what i mean. i just need to find the difference between two times in minutes when one time is in a date data type and the other in a string.
0
 

Accepted Solution

by:
ballpc earned 200 total points
ID: 2586308
Jon,

Use the DateDiff function...

Dim CurrentTime       As Date
 
CurrentTime = "3/5/2000 11:00:00PM"
 
If DateDiff("n", CurrentTime, Now) = 30 Then
    MsgBox "It's been 30 minutes!"
Else
    MsgBox "It's been " & DateDiff("n", CurrentTime, Now) & " minutes!"
End If
0
 

Author Comment

by:jonjhess
ID: 2590006
Thankyou
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

872 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