le 2001/10/16 12:52, Pete à furbies@... a écrit : > I know how far ahead/behind I am from GMT, and how far ahead/behind the > other place is from GMT. What I can't get my very very very very very very > very very very very very very small brain around is, how to calc the > difference in hours/minutes > > Does anyone have an FN that might get me where I want to go ? untested. but is this something along the lines of what you're seeking? you didn't say if you had changed times to decimal so i supposed that they were strings formatted like in a mail/http header. i expect alain, jay and ken can reduce this down to a bout 4 lines, and then someone else will say that there is a toolbox call that does it all in one. meantimes, test and have fun. :-j // expects a string formatted "01:11,+21:15", "01:11,-21:15" // or "HH:MM,Shh:mm" // where "01:11" [HH:MM] is local time // "+21:15" [Shh:mm] is the difference from GMT // and [S] the sign. // returns a string "HH:MM" in GMT local fn trad2GMT$( theStr as str255) dim localHr as int dim localMn as int dim 1 mySign$ dim offGMTHr as int dim offGMTMn as int ' localHr = val( left$( theStr,2)) localMn = val( mid$( theStr,4,2)) mySign$ = mid$( theStr,7,1) // in case sign was forgotten offGMTMn = val( right$( theStr,2)) offGMTHr = val( mid$( theStr, theStr[0] -4,2)) ' long if( mySign$ ="-") // subtract if( offGMTMn > localMn) then offGMTHr = offGMTHr +1 : localMn = localMn +60 localMn = localMn -offGMTMn localHr = localHr -offGMTHr xelse // add localMn = localMn +offGMTMn if( localMn > 59) then localHr = localHr +1 : localMn = localMn -60 localHr = localHr +offGMTHr end if if( localHr >23) then localHr = localHr -24 // format return str$ theStr = str$( localMn) theStr = right$( theStr, 2) : if theStr[1] =_" " then mid$( theStr,1,1) = "0" theStr = ":" +theStr theStr = str$( localHr) +theStr theStr = right$( theStr, 5) : if theStr[1] =_" " then mid$( theStr,1,1) = "0" ' end fn = theStr // compare two formatted time trings with gmt time differences // deducts thatTime from ThisTime and returns a formatted string clear local local fn compareTime$( thisTime as str255, thatTime as str255) dim diffHr as int dim diffMn as int dim thisTemp as int dim thatTemp as int dim myTime as str255 ' thisTime = fn trad2GMT$( thisTime) thatTime = fn trad2GMT$( thatTime) // minutes thisTemp = val( right$( thisTime,2)) thatTemp = val( right$( thisTime,2)) long if( thatTemp > thisTemp) diffHr = -1 thisTemp = thisTemp +60 xelse diffHr = 0 end if diffMn = thisTemp - thatTemp if( diffMn > 59) then diffMn = diffMn -60 : diffHr = diffHr +1 // hours thisTemp = val( left$( thisTime,2)) thatTemp = val( left$( thisTime,2)) diffHr = diffHr +( thisTemp - thatTemp) // format return str$ myTime = str$( diffMn) myTime = right$( myTime, 2) : if myTime[1] =_" " then mid$( myTime,1,1) = "0" myTime = ":" +myTime myTime = str$( diffHr) +myTime myTime = right$( myTime, 5) : if myTime[1] =_" " then mid$( myTime,1,1) = "0" if( diffHr < 0) then myTime = "-" +myTime else myTime = "+" +myTime ' end fn = myTime