Aug 26, 2002 #1 THI Technical User Feb 12, 2002 7 NO I have a field that is defined as date/time, where time is time elapsed in handling a problem. How can I summarize the time part ? I need this in order to calculate average time for handling of problems. regards, Tomh Norway
I have a field that is defined as date/time, where time is time elapsed in handling a problem. How can I summarize the time part ? I need this in order to calculate average time for handling of problems. regards, Tomh Norway
Aug 26, 2002 #2 synapsevampire Programmer Mar 23, 2002 20,180 US Are you saying that the datetime field is stored as: A task that took 1 hour: 8/26/2002 1:00:00 ? If so, and it truly is a datetime field, you can sum times by creating a formula which is the duration in seconds like: dtstoseconds(totext({MyTable.MyDatetimefield})) You can create a summary of this field and display it however you'd like, or use the following example for converting to a time format: WhilePrintingRecords; numberVar dur; numberVar hrs; numberVar min; numberVar sec; stringVar hhmmss; dur = sum(dtstoseconds(totext({MyTable.MyDatetimefield}))) ///or sum the formula above if you need to create the ///formula for detail display. hrs := Truncate(Truncate(dur/60)/60); min := Remainder(Truncate(dur/60),60); sec := Remainder(dur,60); hhmmss := totext(hrs, "0" + ":" + totext(min, "00" + ":" + totext(sec, "00" hhmmss http://www.informeddatadecisions.comkai@informeddatadecisions.com Upvote 0 Downvote
Are you saying that the datetime field is stored as: A task that took 1 hour: 8/26/2002 1:00:00 ? If so, and it truly is a datetime field, you can sum times by creating a formula which is the duration in seconds like: dtstoseconds(totext({MyTable.MyDatetimefield})) You can create a summary of this field and display it however you'd like, or use the following example for converting to a time format: WhilePrintingRecords; numberVar dur; numberVar hrs; numberVar min; numberVar sec; stringVar hhmmss; dur = sum(dtstoseconds(totext({MyTable.MyDatetimefield}))) ///or sum the formula above if you need to create the ///formula for detail display. hrs := Truncate(Truncate(dur/60)/60); min := Remainder(Truncate(dur/60),60); sec := Remainder(dur,60); hhmmss := totext(hrs, "0" + ":" + totext(min, "00" + ":" + totext(sec, "00" hhmmss http://www.informeddatadecisions.comkai@informeddatadecisions.com