Time conversion

B100_TIME_CONVERSION

PROGRAM B100_TEST
VAR 
  XSEC, XMIN, XHOUR: UDINT;
   YSEC ,YMIN, YHOUR: UDINT;
   FB: LIB.CORE.V1_0.B100_TIME_CONVERSION;
END_VAR
 
  FB(SEC := XSEC MIN := XMIN, HOUR := XHOUR, YSEC => YSEC, YMIN => YMIN, YHOUR => YHOUR);
END_PROGRAM

LIB\CORE

V1.0

The block is used for conversions of time and date values to the required formats.

InputType Description Default value
SEC UDINTany number of seconds0
MIN UDINTany number of minutes0
HOUR UDINTany number of hours 0
DAY UDINTany number of days 0
MON UDINTany number of months 0
YEAR UDINTany number of years 0
OutputType Description
YSEC UDINTnumber of seconds
YMIN UDINTnumber of minutes
YHOUR UDINTnumber of hours
YDAY UDINTnumber of days
YMON UDINTnumber of months
YYEAR UDINTnumber of years

The input signals may have any value greater or equal zero. The output returns date and time in the equivalent correct format. A month is considered to have 30 days. A year is considered to have 365,25 days.

The function adds inputs 85 s, 75 min and 5 hours. The result is a sensible value of 6 hours,16 mins and 25 s.

  • © Energocentrum Plus, s.r.o. 2017 - 2024