NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
jdaming
Posts: 9

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()))

Innoventor Inc. "The Original Idea People" http://www.innoventor.com/
Member
Chris V
Posts: 185
0 Kudos

Re: Current Date in WebUI

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
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page