Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 codesys。我有一个包含日期和时间的字符串。我想拆分日期和时间。当前时间:DATE_AND_TIME;在 concat 之后显示像这样的值 DT#2019-08-06-10:06:53 将 currentTime 变量转换为 string 。
现在我想拆分日期和时间值
time : 10:06:53 Date 2019-08-06
请提供减速和执行部分
声明部分:
dtDateAndTime : DATE_AND_TIME; sDateAndTime : STRING; sDate : STRING; sTime : STRING;
实现部分:
sDateAndTime := DT_TO_STRING(dtDateAndTime); sDate := MID(sDateAndTime, 10 , 4); sTime := RIGHT(sDateAndTime, 8);