Expand my Community achievements bar.

SOLVED

Time calculation - full hours aren't calculated correctly

Avatar

Level 2

Hey,

I have a little issue. I was programming a time calculation (dynamic) table and yesterday everything worked, but today no full hours are calculated correctly.

I tried then to display the hour as a decimal number using following script:

this.rawValue = Time2Num(cellabove.rawValue, "HH:MM", "en_GB")

But this happened and I don't know why. I can repeat it for every full hour.

1472440_pastedImage_0.png

1472459_pastedImage_1.png

All times are entered in text fields, but when I change it to time fields it makes no difference and yesterday it worked with text fields.

I managed to get my script to work yesterday but now it only works for not full hours, what can I do?

var endT  = Left(Timeto_einf, 2) + Right(Timeto_einf, 2) / 60

var startT = Left(Timefrom_einf, 2) + Right(Timefrom_einf, 2) / 60

var breakT = Left(Break_einf, 2) + Right(Break_einf, 2) / 60

$.rawValue = (endT - startT - breakT)

Thank you in advance!

Best regards,

Markus

1 Accepted Solution

Avatar

Correct answer by
Level 2

It needed 6 hours and I thought I it is impossible, but found the mistake:

I just needed to use the .formattedValue and everything works!

Well it's never easy, but always simple...

Still thanks!

Markus

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

It needed 6 hours and I thought I it is impossible, but found the mistake:

I just needed to use the .formattedValue and everything works!

Well it's never easy, but always simple...

Still thanks!

Markus