Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Military Time
Message
 
 
To
06/08/2007 14:14:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01245247
Message ID:
01246346
Views:
40
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform