|
-
Oct 17th, 2006, 05:30 AM
#1
Thread Starter
Addicted Member
Time Duration formatting
Hi Everyone , have a great day , take look at line below which is infact VB6 code
VB Code:
duration = Format(CDate(Right(strline(UBound(strline)), Len(strline(UBound(strline))) - 12)) - CDate(Right(strline(0), Len(strline(0)) - 12)), "HH:MM:SS")
Problem is that whenever value of duration exceeds 24 ( one complete day ) it sorta skips 24 , like
in actual scenario value of duration is 31:06 , but it only shows 07:06 , what should i do ? since its VB6 code so i dont know any other format besides " HH:MM:SS" , which i have already given
Regards
-
Oct 17th, 2006, 05:55 AM
#2
Re: Time Duration formatting
What is the Values of the Arrary strline?
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Oct 17th, 2006, 06:16 AM
#3
Thread Starter
Addicted Member
Re: Time Duration formatting
_________________________________________________________________
Event Time: 2006-05-01 12:01:00
Problem Text:
*** ALARM 174 A1/EXT "BSC01 R11/ACA3/"U 060501 1201
RADIO X-CEIVER ADMINISTRATION
BTS EXTERNAL FAULT
MO RSITE CLASS
RXOCF-131 MDLH1199 1
EXTERNAL ALARM
GENSET IN OPERATION
END
Problem Data:
PRCA=53
Clear Time: 2006-05-01 12:03:00
_________________________________________________________________
Thanks for reply mate
Above given block is in that array and i m trying to get duration between event time and clear time ....
Regards
Waiting
-
Oct 17th, 2006, 06:33 AM
#4
Re: Time Duration formatting
How about this:
VB Code:
Option Explicit
Private Function GetTime(strline As String) As String
Dim dtEventDateTime As Date
Dim dtClearDateTime As Date
dtEventDateTime = CDate(Mid(strline, InStr(strline, "Event Time: ") + 12, 19))
dtClearDateTime = CDate(Mid(strline, InStr(strline, "Clear Time: ") + 12, 19))
GetTime = DateDiff("n", dtEventDateTime, dtClearDateTime) & _
" minutes Difference Between Event Time and Clear Time"
End Function
Private Sub Command1_Click()
Dim strline As String
Debug.Print GetTime(strline)
End Sub
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Oct 17th, 2006, 12:28 PM
#5
Thread Starter
Addicted Member
Re: Time Duration formatting
Didn work
"by ref argument type mismatch"
isnt there some other way , i m really frustrated about this "lil " issue
Regards
-
Oct 18th, 2006, 05:57 AM
#6
Re: Time Duration formatting
 Originally Posted by Dastard
Didn work
"by ref argument type mismatch"
isnt there some other way , i m really frustrated about this "lil " issue
Regards
What type of variable is "strline"?
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|