B98_TOTAL_SECONDS_TO_TIME_DATE
PROGRAM TEST B98
VAR
SINT1,SINT2,SINT3,SINT4,SINT5,SINT7: SINT;
INT6,INT8: INT;
FB : LIB.CORE.V1_0.B98_TOTAL_SECONDS_TO_TIME_DATE;
END_VAR
FB(IN:=GETLOCALTIME(),SEC=>SINT1,MIN=>SINT2,HOUR=>SINT3,DAY=>SINT4,MON=>SINT5,YEAR=>INT6,WDAY=>SINT7,REAMINDAY=>INT8);
END_PROGRAM
LIB\CORE
V1.0
The block converts the total seconds starting at 1.1.1970, 0:00, to seconds, minutes, hours etc.
Input | Type | Description |
---|---|---|
IN | DT | Input of DateTime value |
Output | Type | Description |
---|---|---|
SEC | SINT | Seconds |
MIN | SINT | Minuted |
HOUR | SINT | Hours |
DAY | SINT | Days |
MON | SINT | Months |
YEAR | INT | Years |
WDAY | SINT | Day of week (0 = Sunday, 1 = Monday, ..., 6 = Saturday) |
REMAINDAY | INT | Days remaining until the end of the month (last day: remainday = 0) |
The block converts the total time in (starting at 1.1.1970, 00:00), into other units The resulting outputs are sec, min, hour, day, mon, and year. For example, for in=3600 the outputs are sec=0, min=0, hour=1, day=1, mon=1, year=1970. Apart from this, the wday output shows the day of week (0 = Sunday, 1 = Monday, ..., 6 = Saturday).
Note that the input values are in UTC format. If in < 0 then it is supposed that in = 0.
The block, together with B97, is used as an auxiliary block for various time/date conversions, calculating of time spans etc.