ethushara Posted March 4, 2015 Share Posted March 4, 2015 Hi i need to get the system time details in to variables (virtual channels) It should be as he current year, month, date, hour, minute, seconds are to separate Vchannels. For this currently i thought to use the systime(0) to get the no of seconds since 1970 and make a calculation to get these required data. But it is very difficult. But i saw in your help file FormatDateTime() function. But it is not very clear me to use. i tried, but results were not correct. So could you please help me to get this done from this formatdatetime() function or any other easiest method. BR, Thushara. Link to comment Share on other sites More sharing options...
AzeoTech Posted March 5, 2015 Share Posted March 5, 2015 Yes, FormatDateTime() is the easiest, though seconds, minutes and hours can be calculated using normal math as well. The expressions are: Year: strToDouble(formatDateTime("%y", systime())) // use %Y for 4 digit year Month: strToDouble(formatDateTime("%m", systime())) Day of the month: strToDouble(formatDateTime("%d", systime())) Hour: strToDouble(formatDateTime("%H", systime())) or: floor(systime()%86400/3600) Minute: strToDouble(formatDateTime("%M", systime())) or: floor(systime() % 3600 / 60) Second: strToDouble(formatDateTime("%S", systime())) or: floor(systime() % 60) or, if you want the decimal seconds, just: systime() % 60 Link to comment Share on other sites More sharing options...
ethushara Posted March 17, 2015 Author Share Posted March 17, 2015 Hi, Thanks a lot for the instructions. Its working perfectly... BR, Thushara Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.