Solved

Difference in minutes between two dates

Posted on 2000-03-05
3
149 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 50 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now