Store PLCnext CommunityPLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. Arne Smets
  2. PLCnext Technology & PLCnext Controls
  3. Thursday, 25 March 2021

I was wondering if there is a easy solution for the DateTime on the HMI, but then without some parts. For example the '#LTD' and the (micro)seconds.
I've found that the substring or substr functions can get parts of the string easily. The ClientNow in the HMI is from the LDATE_AND_TIME type, so it's not workable as a string.
How can I only show parts of the Clientnow? Should I convert it somehow? Or is there a way to declare a new variable with the current time or date? I can't find another variable in the PLCNext which gets it and updates..


Accepted Answer
Frank PLCnext Team Accepted Answer Pending Moderation
Good Morning Arne,

hmm, there are many options, but maybe the following will already do it:

  • Use the FB RTC_S. It returns the sysytem time as a string according to the IEC 61131 notation. Via "MID" string operation you can take only the parts you like.
  • Or use the RTC int variables and bind them to single text fields for the current date time.

Which way you choose, depends on your preferences, but should be both fairly simple and easy to implement...

Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support

There are replies in this post but you are not allowed to view the replies from this post.