2-589
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Time and Time of Day Instructions
2
GetDaysOfMonth
GetDaysOfMonth
The GetDaysOfMonth instruction gets the number of days in the specified month.
The GetDaysOfMonth instruction gets the number of days in month Month of year Ye a r.
The following example is for when Ye a r is UINT#2012 and Month is USINT#2.
[
• If the value of Ye a r exceeds the valid range, an error will not occur and the value of Out will be an ille-
gal value.
• An error occurs in the following case. ENO will be FALSE, and Out will not change.
• The value of Month is outside of the valid range.
Instruction Name FB/FUN Graphic expression ST expression
GetDaysOfMonth Get Days in Month FUN Out:=GetDaysOfMonth(Year,
Month);
Variables
Name Meaning I/O Description Valid range Unit Default
Ye a r Ye a r
Input
Year 1970 to 2554 Year 1970
Month Month Month 1 to 12 Month 1
Out Days Output Days 28 to 31 Days
---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
Ye a r O K
Month OK
Out OK
Function
Precautions for Correct Use
(@)GetDaysOfMonth
EN ENO
Year Out
Month
abc:=GetDaysOfMonth(UINT#2012, USINT#2);
UINT#2012
USINT#2
LD ST
abc
GetDaysOfMonth
EN ENO
Year
Month
Ye a r
Month
Days
Out=abc
Ye a r
Month
Days
UINT#2012
USINT#29
USINT#2