getCalcDate

Converts a date to the total days since 1.1.1970 to make it easy comparable. You can use Date, or DateTime as input and even if two datetime values do have different times.

Parameters

inputDate - This can be a date or datetime in any format or a controlId to a date or dateTime control

Example Usages

let calcDate1 = app.getCalcDate(app.getFieldValue("myDateTime1"));
let calcDate2 = app.getCalcDate(app.getFieldValue("myDate2"));
if (calcDate1 === calcDate2) {
  //Do something
}

Example Results

app.getCalcDate(new Date("1995-12-17 03:24:00")); //9481 (days since 1.1.1970)
app.getCalcDate("1995-12-17 03:24:00"); //9481
app.getCalcDate("1995-12-17 12:44:30"); //9481
app.getCalcDate(myControlId); //?

Return Values

The getCalcDate function returns a number. It attempts to calculate a numerical representation of a date based on the provided parameter inputDate. The return value represents the number of days since January 1, 1970 (Unix Epoch) for the given date.

Last updated