I am working on a timesheet form and to calculate the time, user should be able to put 24:00 as midnight shift. However the time format seems to change the 24:00 to 00:00 as a default time. Though it accept 23:59, I need user to be able to input 24:00.
How can I write a code in Formcalc or JavaScript to accept 24:00 in a time field.
Thanks,
Roya
Views
Replies
Total Likes
Hi,
to display times in the 24 Hour format use the display pattern time{KK:MM} instead of time{HH:MM}.
Views
Replies
Total Likes
Thank you. This help my issue as well with displaying time. However, I'm having trouble getting it to calculate time correctly for a shifft that begins at 16:00 and ends at 24:00. The time sheet calculates (16.00) instead of (08.00). How can I get the form to calculate correctly. Below is the code in my form. Any assistance is greatly appreciated. Thanks! Janna
form1.detail.Totalhrs1::calculate - (FormCalc, client)
var amTime = 0
if (HasValue(amOut1) and HasValue(amIn1)) then
amTime = Time2Num(amOut1.formattedValue, "KK:MM") - Time2Num(amIn1.formattedValue, "KK:MM")
endif
var pmTime = 0
if (HasValue(pmIn1) and HasValue(pmOut1)) then
pmTime = Time2Num(pmOut1.formattedValue, "KK:MM") - Time2Num(pmIn1.formattedValue, "KK:MM")
endif
// compute total time in hours from the millisecond value
$.rawValue = Sum(amTime,pmTime)/3600000
Views
Replies
Total Likes