Built-in JS Functions Overview


EnOS provides built-in JavaScript functions that you can use in the Script node to convert the input msg into your desired format. The functions are grouped according to their usage.

Time

Use Time functions to add days/time to a specific date.


Function Description
addDays Add days to a specific date/time
addHours Add hours to a specific date/time
addMinutes Add minutes to a specific date/time
addSeconds Add seconds to a specific date/time

Date

Date functions generate and format date values.


Function Description
calculateDateDifference Calculates the time difference between two dates and returns the difference in 4 different time units: seconds, minutes, hours, and days.
compareDates Compares two dates and returns the result as an integer.
dateBuild Builds a date String based on the specified pattern and date units.
dateTimeBuild Builds a date/time String based on the specified pattern and date/time units.
dateTimeFormat Converts a date/time (String) from one format to another.
getCurrentDateString Returns the current date as a String in the specified format.
incrementDate Increments a date/time by the specified date/time units.

Utils

Utils functions provides utility services.

Function Description
generateUUID Generates a random Universally Unique Identifier (UUID).