Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summarizing time elapsed in a date/time field

Status
Not open for further replies.

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
 
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 kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top