• Not Answered

Converting Date and Time as a string to integers

Hi,

I am writing a timestamp as a string parameter on DV from my historian in the following format: mm-dd-yyyy hh:mm:ss. I need to convert this date and time to integers and write in differents parameters (DAY.CV, MONTH.CV etc), how could I make it?

Regards,

Edvaldo

1 Reply

  • The controller can't do any string manipulation so you will need to do this conversion at some other location, Operate, Historian, etc.

    The controller does have some conversion utilities for similar type work but requires Epoch Time, Look in Books Online for TIME_TO_STR function which will be located at this location:

    Configuration -> General Configuration -> Expressions -> Syntax rules -> Functions

    You can also see the TIME function which can be used to generate these current values in the controller.

    Here is example of logic:

    Parameter types from above:

    8 bit Uint = HH, MM, SS, MONTH, DATE
    16 bit Uint = YEAR              
    Named set = DAYWEEK (1=Mon, 2=Tue, ..... 7=Sun)