PDA

View Full Version : Problem:Decimal Time to Standard Time


ABC123

GregOnline
09-10-2001, 12:21 PM
I have been writing a gateway for a payroll program, and the data is exported from the timeclock in decimal (9.50 rather than 9:30)

Is there any way to convert these times with a calculated field?

I broke out the decimal portion with the INT() command, but then when I total all the individual lines for an employee it doesn't recognize that the integer portion should increase after 59 minutes, so I end up with something like this: 77:70.

HHHEEELLLPPP Please!

thanks in advance

Stephen Williams
09-10-2001, 12:31 PM
Mess with this...
TOSECONDS(END)-TOSECONDS(START))/3600

Stephen Williams
09-10-2001, 12:35 PM
And going the other way...
Jhrs = int(Flh/Calc->Size)
Jmins = mod(Flh/Calc->Size,1)*60
Time = alltrim(str(Calc->Jhrs))+":"+alltrim(str(Calc->Jmins))

Stephen Williams
09-10-2001, 12:36 PM
OOps - going too fast here, FLH is a decimal hour quantity...

Stephen Williams
09-10-2001, 12:41 PM
Oh dear - I am adjusting for crew sizes and all sorts of stuff and nonsense

From my interactive editor
Decimal_time = 9.50
Time = alltrim(str(int(Decimal_time)))+":"+alltrim(str(mod(Decimal_time,1)*60))
?time
= "9:30"

csda1
09-10-2001, 03:22 PM
Stephen,

No, NO, NOOOOO! {:?)
As a duly deputized member of the function police, I sentence you to 50 re-reading of the XBasic manual! However, since you do contribute to the board, I'll ask the judge to reduce your sentence to 25 re-readings of the manual!!!!

To convert decimal minutes you would simply use

TOTIME(decimaltime*3600,FormatCode,DecimalPlaces)
which in most cases would be something like

timetext=TOTIME(9.50*3600,2,0)

To convert the other way,

TOSECONDS(timetext)/3600

Regards,

Ira J. Perlow
Computer Systems Design & Associates
csda@mediaone.net