6-69
6 Programming
NJ-series CPU Unit Software User’s Manual (W501)
6-4 Constants (Literals)
6
6-4-2 Types of Constants
Durations
Dates
Times of Day
Dates and Times
Time-related Data
Notation Example Remarks
TIME#{day}d{hour}h{mi
nutes}m{seconds}s{mil-
liseconds}ms
TIME#61m5s • You can also include decimal points such as in “T#12d3.5h”.
• You can also include numerical values that are greater than the
valid range of times. For example, T#-61m5s expresses the same
time as T#-1h1m5s.
• The numerical value is interpreted as a decimal number. If any
number that is not a decimal number is used, a building error will
occur.
• You can specify the order of the time any way you want. For
example, “TIME#1h_2d” is a valid expression. As long as there is
at least one of the following: {day}, {hour}, {minutes}, {seconds},
{milliseconds}, no building error will occur.
T#{day}d{hour}h{min-
utes}m{seconds}s{milli-
seconds}ms
T#61m5s
Notation Example Remarks
DATE#{year}-{month}-
{day}
DATE#2010-1-
10
• You can add one or more zeroes to the beginning of the year,
month, and day. For example, D#2010-1-10 expresses the same
date as D#2010-01-10.
• A building error will occur if you specify any numerical value that
overflows the valid dates. For example, D#2010-01-35 will cause
an error.
• The numerical value is interpreted as a decimal number. If any
number that is not a decimal number is used, a building error will
occur.
D#{year}-{month}-{day} D#2010-1-10
Notation Example Remarks
TIME_OF_DAY#{hour}:{
minutes}:{seconds}
TIME_OF_DAY#
23:59:59.99999
9999
• You can add one or more zeroes to the beginning of the hour,
minute, and second. For example, D#23:1:1: expresses the same
date as D#23:01:01.
• A building error will occur if you specify any numerical value that
overflows valid times. For example, D#24:00:00 will cause an
error.
• The numerical value is interpreted as a decimal number. If any
number that is not a decimal number is used, a building error will
occur.
TOD#{hour}:{min-
utes}:{seconds}
TOD#23:59:59.9
99999999
Notation Example Remarks
DATE_AND_TIME#{ye
ar}-{month}-
{day}:{hour}:{min-
utes}:{seconds}
DATE_AND_TI
ME#2010-10-
10-23:59:59.123
This is the same as the date data and time data types.
DT#{year}-{month}-
{day}:{hour}:{min-
utes}:{seconds}
DT#2010-10-10-
23:59:59.123