Main Content

opc.setDateDisplayFormat

R2026b

Set display format of timestamp for OPC data objects

Description

opc.setDateDisplayFormat(dateFmt) sets the display format of timestamp for OPC UA data objects to dateFmt. The display format persists across MATLAB® sessions.

newFmt = opc.setDateDisplayFormat(___) sets the display format and also returns the new display format in newFmt.

example

Examples

collapse all

Load the OPC UA example data set and set the display format. Display the timestamps and the corresponding values and quality readings of one of the loaded variables.

load opcSampleUaData;
newObj = tsintersect(uaDataVis);
opc.setDateDisplayFormat('HH:MM:SS');
newObj
newObj = 

1-by-3 OPC UA Data object array:

     Timestamp             Double                 Float                     Int32             
    ---------  ------------------------  --------------------------  -------------------  
     09:00:40   40.000000 [Bad (Raw)]      30.000000 [Good (Raw)]      30 [Good (Raw)]  
     09:01:30   90.000000 [Good (Raw)]     90.000000 [Good (Raw)]      90 [Good (Raw)]

Set the display format of timestamp to display date and time, and display the values again.

opc.setDateDisplayFormat('yyyy-mm-dd HH:MM:SS');
newObj
newObj = 

1-by-3 OPC UA Data object array:

         Timestamp                 Double                 Float                      Int32             
    -------------------  ------------------------  --------------------------  -------------------  
    2015-04-22 09:00:40   40.000000 [Bad (Raw)]      30.000000 [Good (Raw)]      30 [Good (Raw)]  
    2015-04-22 09:01:30   90.000000 [Good (Raw)]     90.000000 [Good (Raw)]      90 [Good (Raw)]

Input Arguments

collapse all

Display format of timestamp for OPC UA objects, specified as date format number, character vector, or string as defined by datestr.

Example: opc.setDateDisplayFormat('HH:MM:SS');

Data Types: char | string

Output Arguments

collapse all

Display format of timestamp for OPC UA objects, returned as a character vector.

Version History

Introduced in R2011a

See Also

Functions