Technical FAQs

Ask a Question

How can I subtract current date & time from previous date & time in Vijeo Citect.

To subtract date time in Vijeo Citect, you can use the below sample code as shown : 

--------------------------------------------------------------------------------------- 
FUNCTION DateSub(); 

STRING stop_date , stop_time , Total_1; 
start_date = StrToDate("4/25/2015")+ StrToTime("12:00:00"); 

stop_date = StrToDate("4/26/2015") + StrToTime("12:10:00"); 

Total_1 = TimeToStr(DateSub(stop_date, start_date),5); 

Message("result", Total_1, 64); 

END 

--------------------------------------------------------------------------------------- 
Was this helpful?
What can we do to improve the information ?