Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sum 2 numbers
Message
From
24/08/2004 03:05:11
 
 
To
23/08/2004 17:08:00
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00935735
Message ID:
00935833
Views:
32
>hi,
>yes,Meaning as in time format? 8 hours and 35 minutes + 6 hours and 55 minutes = 15 hours and 30 minutes?
* AddTimeStrings([08:35], [06:55]) = [15:30]

FUNCTION AddTimeStrings

LPARAMETERS ;
	tcTimeString1, ;
	tcTimeString2

RETURN MinutesToTimeString(TimeStringToMinutes(tcTimeString1) + TimeStringToMinutes(tcTimeString2))
* EOM() ****************
FUNCTION TimeStringToMinutes

LPARAMETERS ;
	tcTimeString

RETURN VAL(RIGHT(tcTimeString, 2)) ;
	+ (60 * VAL(SUBSTR(tcTimeString, 1, LEN(tcTimeString) - 3)))
* EOM() ****************
FUNCTION MinutesToTimeString

LPARAMETERS ;
	tnMinutes

LOCAL ;
	lnHours, ;
	lnMinutes

lnMinutes = MOD(tnMinutes, 60)
lnHours = INT(tnMinutes / 60)

RETURN LTRIM(STR(lnHours)) ;
	+ [:] ;
	+ IIF(lnMinutes < 10, [0], []) ;
	+ LTRIM(STR(lnMinutes))
* EOM() ****************
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform