Date and Time Utilities
by Appian Corporation
Description
Use case is unchanged in this update. Quickly manipulate dates without writing complex expression rules. This version fixes a bug and adds "fuzzy" date parsing if no date format is matched.
Features
This plug-in aims to eliminate the need for custom date and time calculation rules. It contains many functions for common date and time manipulation, with an emphasis on the Appian Date and Time data type. It uses Java's native Date classes so it is fast and of minimal size. The functions are listed below and also covered in greater detail in the document included in the file download.
- Adding Units of Time
- addYears
- addMonths
- addDays
- addHours
- addMinutes
- addSeconds
- Subtracting Units of Time
- subtractYears
- subtractMonths
- subtractDays
- subtractHours
- subtractMinutes
- subtractSeconds
- Comparisons
- sameYear
- sameMonth
- sameDay
- sameHour
- sameMinute
- sameSecond
- Elapsed Time
- elapsedTime
- elapsedYears
- elapsedMonths
- elapsedDays
- elapsedHours
- elapsedMinutes
- elapsedSeconds
- elapsedMillis
- Text Parsing
- isValidDate
- parseDate
- Unix Timestamp Conversion
- toUnixTimestamp
- fromUnixTimestamp
- ISO 8601 Conversion
- toIsoDateString
- fromIsoDateString
- Retrieval *nowWithParameter
Release notes
Added two functions:
These functions convert an Appian Datetime value to and from the standard Unix Timestamp integer representation. It is the number of seconds that have elapsed since the Unix epoch, excluding leap seconds. The Unix epoch is 00:00:00 UTC on 1 January 1970.
toUnixTimestamp - Returns the Unix timestamp from datetime fromUnixTimestamp - Returns a Date and Time value by converting a Unix timestamp.
Version history (3)
1.2.0
Added the nowWithParameter function
1.1.0
Fixes a bug in date comparisons (as identified here: https://community.appian.com/discussions/f/plug-ins/17844/date-and-time-utilities---elapsedtime-function-error) and adds fuzzy date parsing if one of the 22 date patterns does not match.
1.0.0
nctions.
*** Comparisons ***
These functions will determine if the two Date and Time values provided are the same down to the given unit of time. E.g. sameDay() will ignore hours, minutes, and seconds and just check if the year, month, and day values are matching.
*** Elapsed Time ***
These functions will give the elapsed whole number (integer) value of the given unit of time for the two Date and Time values passed.
*** Text Parsing ***
These functions will detect and parse the following date and time formats, based on Java's java.text.SimpleDateFormat, in this order:
- M/d/yyyy h:mm a z (Appian's native Date and Time format)
- yyyyMMdd
- dd-MM-yyyy
- yyyy-MM-dd
- MM/dd/yyyy
- yyyy/MM/dd
- dd MMM yyyy
- dd MMMM yyyy
- yyyyMMddHHmm
- yyyyMMdd HHmm
- dd-MM-yyyy HH:mm
- yyyy-MM-dd HH:mm
- MM/dd/yyyy HH:mm
- yyyy/MM/dd HH:mm
- dd MMM yyyy HH:mm
- dd MMMM yyyy HH:mm
- yyyyMMddHHmmss
- yyyyMMdd HHmmss
- dd-MM-yyyy HH:mm:ss
- yyyy-MM-dd HH:mm:ss
- MM/dd/yyyy HH:mm:ss
- yyyy/MM/dd HH:mm:ss
- dd MMM yyyy HH:mm:ss
- dd MMMM yyyy HH:mm:ss
*** ISO 8601 Conversion ***
These functions convert Appian Date and Time value to and from the standard ISO 8601 text representation. This is the same string representation of dates that a!toJson() produces.
Adding Units of Time
- addYears
- addMonths
- addDays
- addHours
- addMinutes
- addSeconds
Subtracting Units of Time
- subtractYears
- subtractMonths
- subtractDays
- subtractHours
- subtractMinutes
- subtractSeconds
Comparisons
- sameYear
- sameMonth
- sameDay
- sameHour
- sameMinute
- sameSecond
Elapsed Time
- elapsedTime
- elapsedYears
- elapsedMonths
- elapsedDays
- elapsedHours
- elapsedMinutes
- elapsedSeconds
- elapsedMillis
Text Parsing
- isValidDate
- parseDate
ISO 8601 Conversion
- toIsoDateString
- fromIsoDateString
Resources
- Download
Date and Time Utilities.pdf
Deployment Instructions