This is a reference page for Date, Number, and String formatting.
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.
Functions that use this date formatting include:
The table below demonstrate some common formatting elements for convenience. Date formatting in Ignition is largely driven by Java's SimpleDateFormat class. See the SimpleDateFormat documentation for more information.
|Day in year||Number|
|Day in month||Number|
|Day name in week||Text|
|Day of week in month||Number||2nd Sunday of the month|
|Hour in day (0-23)||Number|
|Hour in am/pm (1-12)||Number|
|Hour in day (1-24)||Number|
|Hour in am/pm (0-11)||Number|
|Month in year||Month|
|Minute in hour||Number|
|Second in minute||Number|
|Day number of week||Number||(1 = Monday, ..., 7 = Sunday)|
|Week in year||Number||If Dec31 is mid-week, it will be in week 1 of the next year|
|Week in month||Number|
|Time zone||ISO 8601 time zone|
|Year||Year||Lowercase y is the most commonly used year symbol|
|Week year||Year||Capital Y gives the year based on weeks (ie. changes to the new year up to a week early)|
|Time zone||General time zone|
|Time zone||RFC 822 time zone|
Returns a string version of the number argument, formatted as specified by the pattern string. This is commonly used to specify the number of decimal places to display, but can be used for more advanced formatting as well. The pattern string is a numeric format string, which may include any of these characters that instruct it how to format the number.
Functions that use this number formatting include:
The tables below demonstrate some common formatting elements for convenience. Number formatting in Ignition is largely driven by Java's DecimalFormat class. See the DecimalFormat documentation for more information.
|0||Specifies a required digit.|
Specifies an optional digit.
The grouping separator.
|.||The decimal separator.|
A minus sign.
|;||Used to separate positive and negative patterns. The negative subpattern will only be used to specify the prefix and suffix. The number of digits, , minimal digits, and other characteristics are all the same as the positive pattern.|
|%||Multiplies the value by 100 and shows as a percent.|
|'||Used to quote special characters.|
This table shows some numbers, and the result of using various format strings to format them.
Functions that use this data formatting include:
The tables below demonstrate some common formatting elements for convenience. String formatting in Ignition is largely driven by Java's Formatter class. See the Formatter documentation for more information.
Date/Time Formatting Element Suffix
|'H'||Hour of the day for the 24-hour clock, formatted as two digits with a leading zero where necessary, i.e., 00 - 23.|
|'I'||Hour of the 12-hour clock, formatted as two digits with a leading zero as necessary, i.e., 01 - 12.|
|'k'||Hour of the day for the 24-hour clock, i.e., 0-24.|
|'k'||Hour of the 12-hour clock, i.e., 1 - 12.|
|'M'||Minute within the hour formatted as two digits with a leading zero where necessary, i.e., 00 - 59.|
|'S'||Seconds within a minute, formatted as two digits with a leading zero where necessary, i.e., 00 - 59.|
|'L'||Millisecond within the second formatted as three digits with leading zeros as necessary, i.e., 000-999.|
|'B'||Locale-specific full month name i.e. "January", "March".|
|'b'||Locale-specific abbreviated month name i.e. "Jan", "Mar".|
|'A'||Full name of the day of the week i.e. "Monday".|
|'a'||Abbreviated name of the day of the week i.e. "Mon".|
|'Y'||Year formatted as a 4 digit numeric value with leading zeros where necessary i.e. 0005 would be the year 5 in the Gregorian calendar.|
|'y'||Last two digits of the year formatted with leading zeros where necessary.|
|'j'||Day of the year formatted as three digits with leading zeros where necessary, i.e., 001 - 366 for the Gregorian calendar.|
|'m'||Month, formatted as a two digit number with leading zeros where necessary, i.e., 01-13.|
|'d'||Day of the month formatted as two digit number with leading zeros where necessary, i.e,. 00 - 31.|
|'e'||Day of the month formatted as two digits, i.e., 0-31.|
Data Type to Substitute Element Character
|'b', 'B'||Boolean||If the corresponding argument arg is NULL, then a False is substituted into the format string. If arg is boolean, then the string conversion of arg will be substituted into the format string. For every other condition, True is substituted into the format string.|
|'s', 'S'||String||The string value arg is substituted into the formatted sting.|
|'c', 'C'||Character||The unicode value arg is substituted into the formatted string.|
|'d'||Integral||The decimal value arg is substituted into the formatted string.|
|'f'||Floating Point||The floating point value arg is substituted into the formatted string.|
|'t', 'T'||Date/Time||This is the prefix for date/time arg values to be used for string formatting.|