Hi....

I am having one serious issue in visual basic 6 DateDiff( ) function in calculating the diffference in hours
My issue is concerning CASE: 2 mainly.

For the attachment: you will need to have WinRAR to extracts the 3 vb files.

--------------------------------------------------------------------------------------------------------------------------------------------------- VB6 code in Form_Load event
----------------------------------------------------------------------------------------------------------------------------------------------------
Option Explicit

Private Sub Form_Load()

Dim strPast As Date
Dim strCurrent1 As Date, strCurrent2 As Date
Dim intTotalHours1 As Integer, intTotalHours2 As Integer

' ' ' 'Indian short date format : d/M/yyyy has to be used since i am in
' ' ' ' INDIA
' ' ' 'DateDiff() syntax : DateDiff("interval", olderdate, ' '
' ' ' ' newerdate)...PLEASE CHECK!!


strPast = "30/11/2006 10:30:00 PM"
strCurrent1 = "30/11/2006 11:45:00 PM"
strCurrent2 = "1/12/2006 12:45:00 AM"


' ' ' ' ' CASE 1:
intTotalHours1 = DateDiff("h", strPast, strCurrent1)
txtText1.Text = intTotalHours1
' ' ' ' ' output is PERFECT


' ' ' ' ' CASE 2:
intTotalHours2 = DateDiff("h", strPast, strCurrent2)
txtText2.Text = intTotalHours2
' ' ' ' How can this txtbox show : 7751 hours when actually only two
' ' ' ' hours has elapsed

End Sub
----------------------------------------------------------------------------------------------------------------------------------------------------

--
Regards,
Gautam Naidu,
E-mail me: [email protected]