Plug-in (Function & Smart Service)Free

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:

  1. M/d/yyyy h:mm a z (Appian's native Date and Time format)
  2. yyyyMMdd
  3. dd-MM-yyyy
  4. yyyy-MM-dd
  5. MM/dd/yyyy
  6. yyyy/MM/dd
  7. dd MMM yyyy
  8. dd MMMM yyyy
  9. yyyyMMddHHmm
  10. yyyyMMdd HHmm
  11. dd-MM-yyyy HH:mm
  12. yyyy-MM-dd HH:mm
  13. MM/dd/yyyy HH:mm
  14. yyyy/MM/dd HH:mm
  15. dd MMM yyyy HH:mm
  16. dd MMMM yyyy HH:mm
  17. yyyyMMddHHmmss
  18. yyyyMMdd HHmmss
  19. dd-MM-yyyy HH:mm:ss
  20. yyyy-MM-dd HH:mm:ss
  21. MM/dd/yyyy HH:mm:ss
  22. yyyy/MM/dd HH:mm:ss
  23. dd MMM yyyy HH:mm:ss
  24. 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

  • Date and Time Utilities.pdf

    Deployment Instructions

    Download