02-29-2020 12:19 PM - edited 02-29-2020 12:21 PM
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 :
Thank you
Solved! Go to Solution.
03-01-2020 03:27 AM - edited 03-01-2020 03:35 AM
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.
03-01-2020 11:54 AM
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.
03-01-2020 01:03 PM
I finally found the solution, I used SetCtrlVal to display the date and it worked!
Thank you again Roberto!😁