Jay wrote: > >This function will return a string listing the > >number of hours, days, and minutes in the form: > >A slightly more compact version: > >LOCAL FN elapsedTime$( minutes AS LONG ) >DIM dayStr AS STR15 >DIM hourStr AS STR15 >DIM minStr AS STR15 > >minStr = str$( minutes mod 60 ) + " minutes" >if { @ minStr[2] } = _"1 " then minStr[0] -- >hourStr = str$((minutes mod 1440) \\ 60 ) + " hours" >if { @hourStr[2] } = _"1 " then hourStr[0] -- >dayStr = str$( minutes \\ 1440 ) + " days" >if { @ dayStr[2] } = _"1 " then dayStr[0] -- >END FN = dayStr + hourStr + minStr Jay, Leave it to you to produce such a wonderful, elegant solution! While elapsedTime$ is not a standard function in any language-- at least as far as I know-- it was written to work with VB's dateDiff() function that, among other things, allows you to solve the interval in minutes between to events. The result is passed through elapsedTime to break down the minutes into days, hours and remaining minutes. When I first came across this function, I felt it could be useful here even though, to my knowledge, dateDiff() has not yet been cloned in FB^3. You can take a look dateDiff() in action here: <http://www.infoboard.com/packagedoc/cfdocs41/snippets/tagframe.cfm?tagname=DateDiff%0A> You might want to try the interactive example. Also there is some sample code included (to be frank I not sure what the language is.) Any brave souls out there want to tackle a dateDiff() clone? Concerning my original FN elapsedTime$, Stu Cram wrote me off-list offering some excellent suggestions that I would like to share with the group. Please read these in light of Jay's code above: >Ken > >1. Congrats for compiling all these functions. I had a similar but >shorter list of string functions in FBII for one of my projects, >also 'borrowed' from other languages including Excel. You though >have led us way beyond that. > >2. I just tried 'FN elapsedTime$' and may have discovered a bug >that depends on a programmer's preference settings involving \ or / >for division. > >These lines > hrs = INT( minutes / 60 ) > days = INT( hrs / 24 ) >don't need to use INT() function. > >I suspect you wanted to truncate the decimal part and get the >integer less than or equal to the argument. That however is the >older FBII meaning of INT(x) [and some other languages]. In FB^3, >INT(x) nows rounds x to the nearest integer. > >Your program works if the \ key is the default for floating point >division but however fails if it is /. > >Your 2 instructions can be written as > hrs = minutes / 60 > days = hrs / 24 > >In / mode, real results get truncated when assigned to hrs, an integer. >In \ mode, the results is already truncated before assignment to hrs. > >Just my $1/50 worth - I've tripped over old and new INT() usage before. > >HTH >- Stu Cram > Regina, Sask. Canada Thanks so much, Stu! Although the elegance of Jay's version makes mine pale in comparison, so I would suggest any on the list consider it first. I note that he used the division preference you suggested. There is so much to learn and share. I want to take the opportunity to thank all you who have responded to these posts either on or off the list. If there is any sense I'm wasting bandwidth here, just let me know. I know some of you have written and mentioned you already have your own code libraries, so examples may hold little value. I am trying to post code that I have not seen before, or samples that I believe will be of educational value to beginning coders. I've kinda been on a coding roll this weekend and I've got a bunch of stuff backed up waiting to go. And you should see some of the neat stuff Alain has already done! BTW, it's a beautiful day here in Kentucky. Ken