LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Time function

Solved!
Go to solution

Hi there,

I want to get and set the current date in the numeric indicator like shown down below (day in the first numeric indicator, month in the second one and year in the third indicator) . After many searches, I found functions related to time like "time" or "localtime". Problem is that I don't know how to use them although I looked at the NI help.

I wanted to look at the examples provided by NI but the pages don't display !

So here are two questions :

  •  Can anyone explain to me how do we use "time" function ?
  • How can we see examples of functions to better understand them ?

 

Thank you 

 

Capture.JPG

0 Kudos
Message 1 of 4
(2,710 Views)
Solution
Accepted by topic author Yaseen-Zakston

Hello, this old discussion can give you a good starting point in addressing time functions.

 

There are alternatives to use ansi_c functions: the OS gives you GetSystemTime () and GetLocalTime () APIs to work with: some reference can be found starting from here

 

CVI on his side offers GetSystemDate () and GetSystemTime () from the Utility library and functions to treat date/time in National Instruments Binary TIme Format (e.g. GetCurrentCVIAbsoluteTime).

 

As you can see, several instruments are available, each with its own pros and cons: it's up to you to choose the one  that better suits your needs.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 4
(2,662 Views)

Thank you very much, I used GetSystemDate() which seems pretty easy to use. The function worked well as the arguments took the right values. I've gotta display the date in numeric indicators located in a .uir file. I guess I should use SetSystemDate () but the problem is that the arguments required for this function are not UIR constants. Either I don't know how to use or it is not the function I need.

Capture.JPG

0 Kudos
Message 3 of 4
(2,636 Views)
Solution
Accepted by topic author Yaseen-Zakston

I finally found the solution, I used SetCtrlVal to display the date and it worked!

 

Thank you again Roberto!😁

0 Kudos
Message 4 of 4
(2,632 Views)