Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateDiff function keeps giving "0" for an answer

Status
Not open for further replies.

sirnose1

Programmer
Nov 1, 2005
133
US
I have a from with one date and a subform with another date. When I try to calculate the difference in time, I keep getting zero. Here is my code:

Dim frmTemp As New Form_frmTemp

Dim elapsedTime1 As Integer
Dim firstTime As Date
Dim secondTime As Date
firstTime = frmTemp.txtCurrSxTime.Value
secondTime = Me.txtPrevDate.Value

elapsedTime1 = DateDiff("n", firstTime, secondTime)
 
What is displayed by the following code before the DateDiff call ?
MsgBox "firstTime = " & Format(firstTime, "yyyy-mm-dd hh:nn:ss)" _
& vbCrLf & "secondTime = " & Format(secondTime, "yyyy-mm-dd hh:nn:ss)"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top