SCL:

: 2021-01-14

: komatic

: SCL



date time



(SCL).





FUNCTION "DATE_TIME_character" : Void
 
VAR_IN_OUT
_date : Array[1..10] of Char;
_time : Array[1..8] of Char;
END_VAR
 
VAR_TEMP
DandT : DT;
D_T AT DandT : Struct
year : BYTE;
month : BYTE;
day : BYTE;
hour : BYTE;
minute : BYTE;
seconds : BYTE;
msec : BYTE;
msec_weekday : BYTE;
END_STRUCT;
tmp_ret_val : Int;
END_VAR
 
 
BEGIN
tmp_ret_val := READ_CLK(CDT := DandT);

_date[1] := '2'; // Date YYYY-MM-TT
_date[2] := '0';
_date[3] := INT_TO_CHAR(BYTE_TO_INT(SHR(IN := D_T.year AND 16#F0, N := 4)) + 16#30);
_date[4] := INT_TO_CHAR(BYTE_TO_INT(D_T.year AND 16#0F) + 16#30);
_date[5] := '-';
_date[6] := INT_TO_CHAR(BYTE_TO_INT(SHR(IN := D_T.month AND 16#F0, N := 4)) + 16#30);
_date[7] := INT_TO_CHAR(BYTE_TO_INT(D_T.month AND 16#0F) + 16#30);
_date[8] := '-';
_date[9] := INT_TO_CHAR(BYTE_TO_INT(SHR(IN := D_T.day AND 16#F0, N := 4)) + 16#30);
_date[10] := INT_TO_CHAR(BYTE_TO_INT(D_T.day AND 16#0F) + 16#30);

// Time HH:MI:SS
_time[1] := INT_TO_CHAR(BYTE_TO_INT(SHR(IN := D_T.hour AND 16#F0, N := 4)) + 16#30);
_time[2] := INT_TO_CHAR(BYTE_TO_INT(D_T.hour AND 16#0F) + 16#30);
_time[3] := ':';
_time[4] := INT_TO_CHAR(BYTE_TO_INT(SHR(IN := D_T.minute AND 16#F0, N := 4)) + 16#30);
_time[5] := INT_TO_CHAR(BYTE_TO_INT(D_T.minute AND 16#0F) + 16#30);
_time[6] := ':';
_time[7] := INT_TO_CHAR(BYTE_TO_INT(SHR(IN := D_T.seconds AND 16#F0, N := 4)) + 16#30);
_time[8] := INT_TO_CHAR(BYTE_TO_INT(D_T.seconds AND 16#0F) + 16#30);

END_FUNCTION







: 1394

: denzhig    : 2021-01-23

_date[1..4] : - ( ) - 19.. , , , 20.. .

:

(4000 max):

: