# Thread: Problem:Decimal Time to Standard Time

1. ## Problem:Decimal Time to Standard Time

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.

2. ## RE: Problem:Decimal Time to Standard Time

Mess with this...
TOSECONDS(END)-TOSECONDS(START))/3600

3. ## RE: Problem:Decimal Time to Standard Time

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))

4. ## RE: Problem:Decimal Time to Standard Time

OOps - going too fast here, FLH is a decimal hour quantity...

5. ## RE: Problem:Decimal Time to Standard Time

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"

6. ## RE: Problem:Decimal Time to Standard Time

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

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•