What's the format of the fields involved?
And there are no date/time pickers in Acrobat forms (although some third-parties have developed various date pickers).
I have tried the fields as Time 10:30 but my form kept complaining the over the input field as people tended to try and put 10:30am in as 10.30.
I am currently using Number which calculates but gives funny solutions, like subtracting 15 minutes off 10.00 equal 9.75 and of course I want to see 9:45
I am already successfully using a date picker to choose meeting date etc I was hoping someone had developed a time picker too..
You can use drop-downs with values from 1-12, 0-59 and AM/PM...
I have my fields & dropdown formatted as a Number
Like 8.00 and 8.45
When I select 8.00 the field picking up the data calculates
The result shown is 7.85
I want it to say 7.45
Any help appreciated
Then one needs to convert the decimal hours to hours and minutes. There are 60 minutes to an hour so one needs to multiply the decimal portion of the result by 60. The format for the result should be h:MM. The "." separator denotes a decimal value, while the ":" denotes separation of hours and minutes.
You also need to use the decimal values for the minutes if you are going to use the raw values for the computation or convert the inputted values of hours and minutes converted to minutes, then subtracting 15 minutes, and then convert the total minutes into the hours:minutes format.
You should also consider how to handle times from 12:00 am and 12:14 amp since the result of these calculations would be a time in the previous day.
A possible script without the meridian:
// get hours and minutes;
var nHrs = 10; // 10:00 am
var nMins = 0;
app.alert("Input time: " + util.printf("%,101.0f", nHrs) + ":" + util.printf("%,102.0f", nMins), 3, 0);
// convert imputted hours and minutes into total minutes;
var nTotalMins = (nHrs * 60) + nMins
// subtract 15 minutes from total minutes;
nTotalMins -= 15;
// format total minutes back to hours:mintues;
// get whole hours from total minutes;
var nEndHrs = Math.floor(nTotalMins / 60);
// get remander minutes from total minutes;
var nEndMins = nTotalMins % 60;
// create display stirng;
var cEndTime = util.printf("%,1 1.0f:%,102.0f", nEndHrs, nEndMins);
app.alert("Start tme less 15 min is " + cEndTime, 3, 0);
Thanks for the information..
I am a total noob at this so although I can see how the code sample works I have no understanding of how to pickup my data and modify the formula
I am using a drop down field called MTStart where uses select a time, eg 10.00 I am using another hidden field to pick up that choice and deduct 15 minutes from their choice
Checking all my fields they conform to your suggestions but pasting the code as supplied doesn't return any result or error.
Any support appreciated
Found an easier way to handle..
Used a dropdown box with setting the Options TAB value set to Export a value 15 minutes before selected time.
So the client can see and select 10:00 the exported value is set to 9:45
I then picked up that value in a new text field and could use that