Date and Time of Day Format

Help Contents

Introduction

Dates and times are important SCADA attributes that informs the operator when events occurred. You can use custom Date and Time of Day Format patterns to change the way dates and times are displayed.

A custom Date and Time of Day Format consists of a pattern of characters.

Supported Pattern Letters

These pattern letters are supported in custom date times:

LetterDescriptionExample
y Display the year.
  • Use yy to display the year as two digits.
  • Use yyyy to display the year as four digits.
yy=19
yyyy=2019
M Display the month of the year (1-12).
  • Use M to display one or two month digits, for example 1.
  • Use MM to display 2 month digits, for example 01.
  • Use MMM to display the short month name, for example Jan.
  • Use MMMM to display the full month name, for example January.
MM=05
MMM=May
D Display the day of the year (1-366). The first day of the year is 1. The last day of the year is either 365 or 366.
  • Use D to display the day of the year as 1, 2 or 3 digits.
  • Use DDD to display the day of the year as 3 digits.
D=5
DDD=005
d Display the day of the month (1-31). The first day of the month is 1. The largest day of the month is 31.
  • Use d to display the day of the month as 1 or 2 digits.
  • Use dd to display the day of the month as 2 digits.
d=1
DD=01
E Display the day name.
  • Use E to display the short day name, for example Mon.
  • Use EEEE to display the full day name, for example Monday.
E=Mon
EEEE=Monday
u Display the day of the week number (1-7). 1 = Monday, 2 = Tuesday, ..., 7 = Sunday. u=1
a Display an AM or PM indicator. a=AM
H Display the hour of the day (0-23).
  • Use H to display the hour of the day as 1 or 2 digits.
  • Use HH to display the hour of the day as 2 digits.
HH=09
k Display the hour of the day (1-24).
  • Use k to display the hour of the day as 1 or 2 digits.
  • Use kk to display the hour of the day as 2 digits.
kk=24
K Display the hour within AM or PM (0-11).
  • Use K to display the hour of the day as 1 or 2 digits.
  • Use KK to display the hour of the day as 2 digits.
KK=09
h Display the hour within AM or PM (1-12).
  • Use h to display the hour of the day as 1 or 2 digits.
  • Use hh to display the hour of the day as 2 digits.
h=09
m Display the minute of the hour (0-59).
  • Use m to display the minute of the hour as 1 or 2 digits.
  • Use mm to display the minute of the hour as 2 digits.
m=9
mm=09
s Display the second of the minute (0-59).
  • Use s to display the second of the minute as 1 or 2 digits.
  • Use ss to display the second of the minute as 2 digits.
s=9
ss=09
S Display milliseconds.
  • Use S to display tenths of seconds as one digit.
  • Use SS to display hundredths of seconds as two digits.
  • Use SSS to display milliseconds as three digits.
S=5
SSS=500
Z Display the RFC 822 time zone. Z=-0800
X Display the ISO 8601 time zone.
  • Use X to display the time offset as sign plus hours only.
  • Use XX to display the time offset as sign plus hours and minutes.
  • Use XXX to display the time offset as sign plus hours and minutes separated by a colon(:).

Note: If the time zone offset is zero, the letter Z is displayed.

X=-08
XX=-0800
XXX=-08:00

Where to Use Date and Time of Day Formats

You can use Date and Time of Day Format strings in these areas:

Examples

These examples show how date and time patterns can change the way date and time values are displayed:

ExampleResult
yyyy-MM-dd HH:mm:ss.SSS 2019-03-10 10:16:23.780
Note: This is the default date and time pattern.
dd-MMM-yyyy HH:mm:ss.S 10-Mar-2019 10:16:23.7
yyyy-MM-ddtHH:mm:ss.SSSXXX 2019-03-10t10:16:23.780-08:00
Note: Complies with ISO 8601.
hh 'o''clock' a 12 o'clock PM

Further Information

Number Format

To learn how to format numbers.

Fernhill SCADA Concepts

To learn about other Fernhill SCADA Concepts.

FORMAT_DATE_TIME()

To learn how to format dates and times in IEC 61131-3 code.

Glossary

For the meaning of terms used in Fernhill SCADA.