Hi all,
I like to create a DateAdd function in PB, to do this...
Code: Select all
k = PeekL(@buffer$ + 22) ; k = number of seconds past since 01/01/1970 00:00:00 hour
LogDate = DateAdd("s", k, "01.01.1970") ; ad the seconds in k to 1970 and calculate the date k is representingAdding k is easy...and calculating the days and time also...
This is the start
Code: Select all
Procedure MyMod(a,b)
ProcedureReturn a - (a/b)*b
EndProcedure
timestring.s="23:26:58" ; starttime in string
Debug "StartTime: "+ timestring
timevalue=Val(Left(timestring,2)) * 3600
timevalue + Val(Mid(timestring,4,2)) * 60
timevalue + Val(Right(timestring,2))
Debug "StartTime in Seconds: "+Str(timevalue) ; starttime in seconds
k=902314
Debug "Add "+ Str(k) + " seconds To time, about "+Str(k/60)+" minutes"
timevalue + k
a$= Using("00",timevalue / 3600 /24) + " days, time: " ; days
a$ + Using("00",MyMod(timevalue / 3600,24)) + ":" ; hours
a$ + Using("00",MyMod(timevalue / 60, 60)) + ":" ; minutes
a$ + Using("00",MyMod(timevalue,60)) ; seconds
Debug a$
; Note: Not using Imod in Mathextras for OS independence
; Note: using() from Mr Skunks library just for display purposes
Regards,
Benny
http://www.benny.zeb.be
