0

i 'm working on codesys . I have a string which has the DATE AND TIME .I want to split the date and time . currentTime: DATE_AND_TIME; showing value like this DT#2019-08-06-10:06:53 after concat Convert the currentTime variable into string .

Now i want to split the date and time values

 time :     10:06:53
  Date      2019-08-06

Please provide the deceleration and implementation part

ks1322
  • 33,961
  • 14
  • 109
  • 164

1 Answers1

1

Declaration part:

 dtDateAndTime     : DATE_AND_TIME;
 sDateAndTime      : STRING;
 sDate             : STRING;
 sTime             : STRING;

Implementation part:

sDateAndTime := DT_TO_STRING(dtDateAndTime);
sDate := MID(sDateAndTime, 10 , 4);
sTime := RIGHT(sDateAndTime, 8);
Filippo Boido
  • 1,136
  • 7
  • 11