Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sum 2 numbers
Message
De
24/08/2004 03:05:11
 
 
À
23/08/2004 17:08:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00935735
Message ID:
00935833
Vues:
31
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform