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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtracting Time

Status
Not open for further replies.

wgechter

MIS
Jul 24, 2002
85
US
I have two formulas:

{@timeopened}
numbervar times:= {MRSC99.T_CHART_OPEN};
timevar tm;
tm:=time(dateadd("s",times,datetime(0,0,0,0,0,0)));
Time(hour(tm),minute(tm),second(tm))

{@timeclosed}
numbervar times:= {MRSC99.T_CHART_CLOSED};
timevar tm;
tm:=time(dateadd("s",times,datetime(0,0,0,0,0,0)));
Time(hour(tm),minute(tm),second(tm))

I want to be able to say {@timeopened} - {@timeclosed}. This formula doesn't work. What will? Thanks, Wendi
 
What are the datatypes of {MRSC99.T_CHART_OPEN} and {MRSC99.T_CHART_CLOSED}?

-LB
 
I just tested your formulas, using a number field for your database field in each case, and the subtraction formula worked fine--as long as the first value was the larger one. Shouldn't your formula be:

{@timeclosed}-{@timeopened}

I'm assuming that the difference always occurs on the same day.

-LB
 
WOW! That was the most brain dead thing I've done in a while. Yeah, it works fine if you're not being an idiot. Thanks, Wendi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top