Skip to main content
Version: 8.1

Data Type Formatting Reference

This is a reference page for Date, Number, and String formatting.

Date Format​

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:

note

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.

SymbolDescriptionPresentationExamplesOther Notes
aAm/Pm markerTextPM
DDay in yearNumber189
dDay in monthNumber10
EDay name in weekTextEEEE=Tuesday; E=Tue
FDay of week in monthNumber22nd Sunday of the month
GEra designatorTextG=AD
HHour in day (0-23)Number0
hHour in am/pm (1-12)Number12
kHour in day (1-24)Number24
KHour in am/pm (0-11)Number0
MMonth in yearMonthMMMM=July; MMM=Jul; MM=07
mMinute in hourNumber30
sSecond in minuteNumber55
SMillisecondNumber978
uDay number of weekNumber1(1 = Monday, ..., 7 = Sunday)
wWeek in yearNumber27If Dec31 is mid-week, it will be in week 1 of the next year
WWeek in monthNumber2
XTime zoneISO 8601 time zoneX=-08; XX=-0800; XXX=-08:00
yYearYearyyyy=1996; yy=96Lowercase y is the most commonly used year symbol
YWeek yearYearYYYY=2009; YY=09Capital Y gives the year based on weeks (ie. changes to the new year up to a week early)
zTime zoneGeneral time zonezzzz=Pacific Standard Time; z=PST
ZTime zoneRFC 822 time zoneZ=-0800

Number Format​

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:

note

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.

SymbolDescription
0Specifies a required digit.
#Specifies an optional digit.
,The grouping separator.
.The decimal separator.
-A minus sign.
EScientific notation.
;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.

Example​

This table shows some numbers, and the result of using various format strings to format them.

NumberPatternResult
505
50.05.0
500.005.0
123#,##0123
1024#,##01,024
1337#,##0.#1,337
1337.57#,##0.#1,337.6
87.32#,##0.000087.3200
-1234#,##0-1,234
-1234#,##0;(#)(1,234)
40960.###E04.096E3
.348#.00%34.80%
34.8#0.00'%'34.80%

String Format​

Functions that use this data formatting include:

Date/Time Formatting Elements​

Date/Time Formatting Element SuffixDescription
HHour of the day for the 24-hour clock, formatted as two digits with a leading zero where necessary, i.e., 00 - 23.
IHour of the 12-hour clock, formatted as two digits with a leading zero as necessary, i.e., 01 - 12.
kHour of the day for the 24-hour clock, i.e., 0-24.
kHour of the 12-hour clock, i.e., 1 - 12.
mMinute within the hour formatted as two digits with a leading zero where necessary, i.e., 00 - 59.
SSeconds within a minute, formatted as two digits with a leading zero where necessary, i.e., 00 - 59.
LMillisecond within the second formatted as three digits with leading zeros as necessary, i.e., 000-999.
BLocale-specific full month name i.e. "January", "March".
bLocale-specific abbreviated month name i.e. "Jan", "Mar".
AFull name of the day of the week i.e. "Monday".
aAbbreviated name of the day of the week i.e. "Mon".
YYear formatted as a 4 digit numeric value with leading zeros where necessary i.e. 0005 would be the year 5 in the Gregorian calendar.
yLast two digits of the year formatted with leading zeros where necessary.
jDay of the year formatted as three digits with leading zeros where necessary, i.e., 001 - 366 for the Gregorian calendar.
MMonth, formatted as a two digit number with leading zeros where necessary, i.e., 01-13.
dDay of the month formatted as two digit number with leading zeros where necessary, i.e,. 00 - 31.
eDay of the month formatted as two digits, i.e., 0-31.

Formatting Elements​

Element CharacterData Type to Substitute Element CharacterDescription
b, BBooleanIf 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, SStringThe string value arg is substituted into the formatted sting.
c, CCharacterThe unicode value arg is substituted into the formatted string.
dIntegralThe decimal value arg is substituted into the formatted string.
fFloating PointThe floating point value arg is substituted into the formatted string.
t, TDate/TimeThis is the prefix for date/time arg values to be used for string formatting.