Working With Time

Post here any hints or tips you have for Go Calc

Working With Time

Postby srbarlow » Tue Apr 06, 2010 11:28 pm

I use time a lot for calculations and had to figure a way to manage time input and manipulation.

I have time entered in the two decimal format H.mm where H is hours and mm is minutes from 0 to 59. Note that for minutes less than 10 the leading zero must be entered.

To convert an input in this form to minutes for use in calculations I use the following trick:

(( Hmm - ( mod (( Hmm*100), 100) / 100)) *60) + ( mod(( Hmm*100), 100))

after performing calculations with minutes ( elapsed time for example), the following will convert whole minutes back into the decimal H.mm format.

((( MINS -(mod(MINS,60)))/60) + ((mod(MINS,60))/100))

At least this is how I did it with the limited library of functions in Go Calc.

I'd like to see some string functions and also some input error checking.

I like to be able to set an input format and value range and create a custom error string to alert a user if the improper format or values range was entered.
srbarlow
 
Posts: 1
Joined: Tue Apr 06, 2010 11:00 pm

Return to Hints and tips

Who is online

Users browsing this forum: No registered users and 1 guest

cron