?
Solved

Difference in minutes between two dates

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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

770 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