NI TestStand Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Elaine_R.

Date() / time() functions could allow for different desired formats as a parameter rather than returning N local variables

Status: New

currently the behavior of the date function is (1) get a short ("MM/DD/YYYY") or long form date string ("Weekday, Month D, YYYY")with nice easy boolean input, (2) pass it N local variables to get all the discrete parts and assemble it myself with a bit of STR() and concatenation.

 

could we create a permutation on this date() function, (does one already exist) so that I can just pass it a %<> syntax string and have it format the current date to my desired format?

 

specifically, I'm looking for a non painful way of building a "YYYY-MM-DD" style string for a report (or even just DD/MM/YYY) without having to lug around 8 locals and a lengthly expression, or call into a LV VI. 

 

We have basic string format symbols available for the STR and VAL functions, why not for date? if anything passing this 1 parameter might save alot of folks creating a bunch of locals because they can just ask for the time item they want directly, and then VAL() the output text to get the numeric data if they need it?

 

it'd be awesome if the function supported standard DB format tags such as (http://www.w3schools.com/sql/func_date_format.asp) or failing that, was consistent with what LabVIEW's time format strings were.

 

Just a thought. Has anyone worked around this in a reasonable way?

 

--Elaine R.

1 Comment
paulmw
Active Participant

 

Just a thought. Has anyone worked around this in a reasonable way?

 

--Elaine R.



Use a .NET call into mscorlib.  System.DataTime.Now.ToString(System.String)

 

DateTimedotNet.png