Help with util.scand
Good afternoon Community folks! I think I'm having an issue with understanding the purpose of what util.scand is doing. This is a function that converts a date into a number of milliseconds correct?
I'm building a worksheet that has a user put in a date and time (two separate fields) and a number of the calculated fields afterwards is to calculate a certain time afterwards (12 hours, 36 hours, 72 hours). In the past, I was able to use it to pull a date and increment it by 1 but now that this new sheet has a time component I'm finding myself failing to understand what I'm actually doing.
var dateStringDay = this.getField("cultureStartHighDate").valueAsString;
var dateStringTime = this.getField("cultureStartHighTime").valueAsString;
var fullDate = dateStringDay + dateStringTime
if (fullDate=="") event.value = "";
else {
var date=util.scand("mm/dd/yy HH:MM", fullDate)
date.setDate(date.getDate()+<A value here>);
event.value=util.printd("mm/dd/yy HH:MM", date);
}
In the above code, I'm pulling in the start date and the start time as two separate fields then combine them with the fullDate variable. Because they are strings there shouldn't be any math done there... I think? I'm using an if statement to make sure if a field is cleared out it doesn't throw any error messages but if there is something there then the util.scand should bu converting the fullDate into a millisecond value correct?
I found this post (https://community.adobe.com/t5/acrobat-sdk-discussions/i-need-help-with-a-form-that-calculates-hours-worked/m-p/13296172#M90123) which I think has most of the answers but my JS knowledge might be too lacking in understanding what is going on in the thread and to convert it to my need. I've also found other post where it seems like they are using the split function to put the dates and times into arrays but if I were to do that I feel like I would need to nest arrays together and I don't know if that is even something I could manage with my knowledge either! Any help or guidance would totally be worth me buying you a beer or something!
