同意楼上的说法, 即: 在系统功能块SFC28的SDT不能直接赋DT常量; 在系统功能块SFC1的CDT也不能直接赋DT常量!
你可以在一个FC或FB中, 写下以下程序试试.
L D#2007-5-17 //End date time-of-day interrupt
T #IN_DATE //End date is written to variable
L TOD#20:0:0.0 //IN_DATE
T #IN_TIME //End time is written to variable
CALL FC 3 //"D_TOD_DT" (conversion D and TOD to DT)
IN1:= #IN_DATE // Input variable date (format DATE)
IN2:= #IN_TIME // and input variable time (format TIME_OF_DAY)
RET_VAL:= #S_D_T // to form output variable (format DATE_AND_TIME)
CALL "SET_TINT"
OB_NR :=
SDT :=#S_D_T // Data Type: Date_And_Time
PERIOD :=
RET_VAL:=
07-05-17 11:33