Game Tool Help
  Welcome Guest
 Redsack Message Board Forum Listing
   Visual Basic  
           VB TimeDiff none existent, not any more  
Forum Quick Jump
    Printable version of this thread.


Admin
Registered Member
Joined Mar 2006
Total Posts : 23
Email Address Not Available To Guest AccountsPersonal Homepage Not Available To Guest AccountsPrivate Messaging Not Available To Guest AccountsAIM Not Available To Guest AccountsICQ Not Available To Guest AccountsY! Not Available To Guest AccountsMSN Not Available To Guest Accounts
   Posted Wednesday, April 12, 2006 - 7:16:09 AM (GMT -4)    Quote This PostAlert An Admin About This Post.
Work out the difference between to times, so wrote this code to do it.
Now you can get the time difference across any dates, inputs are fully qualified i.e. “12/04/06 10:12:13”


Somebody said...
Public Function TimePeriod(StartTime As String, FinishTime As String) As String
Dim MyDays As String
Dim MyHours As Single
Dim MyMinutes As Single
Dim MySeconds As Single
Dim ToRemove As Long
Dim sDate As Date
Dim sTime As String
Dim fDate As Date
Dim fTime As String

sDate = Format(Mid(StartTime, 1, InStr(StartTime, " ") - 1), "dd/mm/yy")
sTime = Format(Mid(StartTime, InStr(StartTime, " ") + 1), "hh:mm:ss")
fDate = Format(Mid(FinishTime, 1, InStr(FinishTime, " ") - 1), "dd/mm/yy")
fTime = Format(Mid(FinishTime, InStr(FinishTime, " ") + 1), "hh:mm:ss")



MySeconds = DateDiff("s", sDate & " " & sTime, fDate & " " & fTime)
MyDays = Fix(((MySeconds / 60) / 60 / 24))
ToRemove = MyDays * 24 ' hours
MyHours = Fix(((MySeconds / 60) / 60) - (MyDays * 24))
ToRemove = Fix((ToRemove * 60) + (MyHours * 60)) 'minutes
MyMinutes = Fix((MySeconds / 60) - ToRemove)
ToRemove = Fix((ToRemove * 60) + (MyMinutes * 60)) 'seconds
MySeconds = MySeconds - ToRemove



TimePeriod = "Days=" & MyDays & " Hours=" & MyHours & " Minutes=" & MyMinutes & " Seconds=" & MySeconds
TimePeriod = MyHours + (MyDays * 24) & ":" & MyMinutes & ":" & MySeconds

End Function
    Printable version of this thread.
Forum Information
All times shown are (GMT -4)
The date/time now is Friday, September 10, 2010 11:39:12 AM
There are a total of 42 posts in 15 threads.
The newest member is GreenBean who joined on 1/21/2010.
Who's Online Now :
2 Guests, 0 Registered members

Greg {ReAl}SideWINdEr - AAGTT
Comments to autoendgame@redsack.com
Copyright © 2006 Redsack.com All rights reserved.