This function is used by Ignition's Expression language.


Returns the given date as a string, formatted according to a pattern. The pattern is a format that is full of various placeholders that will display different parts of the date. These are case-sensitive! These placeholders can be repeated for a different effect. For example, M will give you 1-12, MM will give you 01-12, MMM will give you Jan-Dec, MMMM will give you January-December.

Refer to Data Type Formatting Reference for a table of the placeholders.


Expert Tip: This function uses the Java class java.text.SimpleDateFormat internally, and will accept any valid format string for that class.


dateFormat(date, pattern)

  • Parameter

Date date - The starting date.

String pattern - The pattern to format the given date to.

  • Results

String - The given date formatted based on the given format pattern.

Code Snippet
dateFormat(toDate("2003-9-14 8:00:00"), "yyyy-MM-dd HH:mm:ss") //Returns the string "2003-09-14 08:00:00" This format is accepted in most databases.
Code Snippet
dateFormat(toDate("2003-9-14 8:00:00"), "yyyy-MM-dd h a") //Returns the string "2003-09-14 8 AM".
Code Snippet
dateFormat(toDate("2003-9-14 8:00:00"), "MMM d, yyyy") //Returns the string "Sep 14, 2003".
Code Snippet
dateFormat(now(), 'yyyy-MM-dd 00:00:00') //Returns the current date, but forces the time to 00:00:00.
  • No labels