From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Web UI Builder and Data Dashboard

cancel
Showing results for 
Search instead for 
Did you mean: 

Current Date in WebUI

I recently had to get the current date (could be quite easily expanded to time also I believe) and found a solution I thought I would post incase someone has this problem.

 

It means you don't have to use a webservice like this tutorial suggests: http://zone.ni.com/reference/en-XX/help/373286A-01/uibuilder/wuib_gsg1/

 

The trick is using pythons datetime class.  I find a lot of cool basic functions can be used this way.  Here is the code that is run when the stop button is pressed:

from datetime import date
runtime.SetProperty("Output.Text",str(date.today()))

Message 1 of 2
(5,920 Views)

Hi jdaming,

 

Very cool!

 

You might consider posting this in the NI Community as Example Code.

 

Have a great day,

 

Chris V

Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(5,913 Views)