Block that converts a date and time value to the EPOCH format.
Ladder Representation

Block Structure
Variable Type |
Name |
Data Type |
Description |
VAR_INPUT |
EN |
BOOL |
Block enabling |
Second |
BYTE |
Seconds |
|
Minute |
BYTE |
Minutes |
|
Hour |
BYTE |
Hours |
|
Day |
BYTE |
Days |
|
Month |
BYTE |
Months |
|
Year |
WORD |
Years |
|
VAR_OUTPUT |
ENO |
BOOL |
End of operation |
Result |
DWORD |
Value in EPOCH |
Operation
When this block has a TRUE value in EN, it interprets the date and time values and converts them to EPOCH, storing in Result.
When EN has FALSE value, Result remains unchanged.
The ENO value forwards to the next Ladder block the EN value after the operation is completed.
Example in Ladder

The example above converts the date and time to EPOCH (DWORD) format, storing the final result in RESULT. The block ends with success, and the ENO output is activated.
Example in ST
The example below displays instructions for applying the example above in ST language.
VAR enable : BOOL := 1; done : BOOL; sec : BYTE := 30; min : BYTE := 30; hour : BYTE := 12; day : BYTE := 15; month : BYTE := 6; year : WORD := 2030; epoch : DWORD; END_VAR
done := FB_DATETIME_TO_EPOCH(EN:=enable, Second:= sec, Minute:=min, Hour:=hour, Day:=day, Month:=month, Year:=year, Result=> epoch);
|
|---|