Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Lazy Man Request
Message
From
12/03/2002 13:47:51
 
 
To
12/03/2002 13:05:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00631578
Message ID:
00631657
Views:
21
Sorry, mine acepts seconds as the input. You can change it easily to minutes.

>>Does anybody have a routine written (that they will share) that will take an integer that represents minutes and turn it into a text format for hours/days
>>
>>Example: 7200 would return 5 Days
>> 420 would return 7 Hours
>>
>>Thanks in advance.
>>
>>Kirk
>
>Try this:
>
>
>LPARAMETERS nSeconds
>* 86400 = Seconds per day
>*  3600 = Seconds per hour
>*    60 = Seconds per minute
>
>LOCAL nDays, nHours, nMinutes, cResult
>
>STORE 0 TO nDays, nHours, nMinutes
>cResult = ''
>
>* How many days
>DO WHILE nSeconds > 86400
>	nDays = nDays + 1
>	nSeconds = nSeconds - 86400
>ENDDO
>
>* How many hours
>DO WHILE nSeconds > 3600
>	nHours = nHours + 1
>	nSeconds = nSeconds - 3600
>ENDDO
>
>* How many minutes
>DO WHILE nSeconds > 60
>	nMinutes = nMinutes + 1
>	nSeconds = nSeconds - 60
>ENDDO
>
>IF nDays > 0
>	cResult = TRANSFORM(nDays) + ' Days '
>ENDIF
>IF nHours > 0
>	cResult = cResult + TRANSFORM(nHours) + ' Hours '
>ENDIF
>IF nMinutes > 0
>	cResult = cResult + TRANSFORM(nMinutes) + ' Minutes '
>ENDIF
>IF nSeconds > 0
>	cResult = cResult + TRANSFORM(nSeconds) + ' Seconds '
>ENDIF
>
>RETURN cResult
>
>
Previous
Reply
Map
View

Click here to load this message in the networking platform