Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Difference in minutes between two dates

Posted on 2000-03-05
3
Medium Priority
?
158 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
[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
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

636 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