Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Military Time
Message
 
 
À
06/08/2007 14:14:47
Vernon Chambers
New York City Transit
New York, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01245247
Message ID:
01246346
Vues:
41
>Peter,
>
>I may have just what you're looking for. I use the following function (I created) in my applications. Give a try and tweak if needed.
>
>*NOTE: replace strz with strtran to stuff zeros
>
>Hope this helps
>
>Here's the code:
>
>
>******************************************************************************
>*********		Convert numeric parameter and return string in military time format                ******
>******************************************************************************
>FUNCTION miltime
>*---------------------------------*
>PARAMETERS nMinutes
>
>LOCAL cRetval, nHours, nMins, cSuffix
>
>STORE "" TO cRetval, cSuffix
>
>IF nMinutes < -999 .OR. nMinutes > 2159
>	RETURN cRetval
>ENDIF
>
>** set correct suffix and 'normalize' number of minutes
>DO CASE
>CASE nMinutes < 0
>	cSuffix = "B"
>	nMinutes = nMinutes + 1440
>CASE nMinutes < 720
>	cSuffix = "A"
>CASE nMinutes < 1440
>	cSuffix = "P"
>OTHERWISE
>	cSuffix = "X"
>	nMinutes = nMinutes - 1440
>ENDCASE
>
>* now calculate
>nHours = INT(nMinutes/60)
>nMins = nMinutes % 60
>
>RETURN  strz(nHours,2) + strz(nMins,2) + cSuffix
>
>ENDFUNC
>
>
What is A, P and X here?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform