Display Time and Date on a Graph or Chart in LabVIEW

Updated Oct 25, 2023

  • I want to plot data with timestamps created from the current time and date.
  • I want my data and the timestamps to be displayed on a Waveform Graph, Waveform Chart, or XY Graph in LabVIEW.
  • How do I create timestamps for use with my graph or chart?

The Get Date/Time In Seconds VI can be used to acquire a timestamp using the current time and date of the system running LabVIEW. The implementation of this VI depends on whether a Waveform Chart, Waveform Graph, or XY Graph is used to display the data and timestamp.

The VI Snippet below illustrates the different ways of implementing the Get Date/Time In Seconds VI depending on your desired output.

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.
The timestamp created by the Get Date/Time In Seconds VI is represented as the number of seconds elapsed since 12:00 a.m., Friday, January 1st, 1904, Universal Time. The X-axis displaying these timestamp values must also be configured to use the same convention. Perform the following steps to configure this setting:
  1. Right-click the x-axis and select Formatting from the shortcut menu.
  2. In the dialog box that appears, set the format to Absolute time, then click the OK button.

Timestamps created using the Get Date/Time In Seconds VI should now be properly displayed on the x-axis. Date can now be displayed on the graph or chart along with corresponding timestamps.

Note: Make sure that the Ignore waveform time stamp on x-axes box is unchecked or LabVIEW will choose the system clock time over the time stamp you created in your waveform.

Additional Information

To edit the Waveform Chart, right-click on the chart to open the Properties Menu. In the Display Format tab you can set up how the time is being displayed on the X-axis. To show date and time use Absolute time and select the time format of your preference. Also you can use the Advanced editing mode to define the format using a Format String.