09-16-2016 03:32 PM
LabVIEW allows you to specify the format by using format codes for example
MMDDYY-00:00 would be specified like %m%d%%y-%H:%M
I’m looking for an equivalent way to specify this in TestStand that I can use the SearchandReplace function to replace text in a template file with the format specified by the LabVIEW statement above.
09-19-2016 11:56 AM
Hi RF_Dude_22,
Formatting date and time in TestStand is more manual than it is in LabVIEW. This example shows how you can generate a date string using the Date() function. The same idea can be applied using the Time() function to create a time string.
09-19-2016 12:22 PM
What I have done is created a vi that creates the string I need in the format I need and assign it to a Local in TestStand, then I just read the contents of that Local using the SearchandReplace function. This works well, but was really hoping to be able to have TestStand creat the format I need, but have been unable to find a way. Yes, I can use the Date() and Time() functions to get the information I need, but then I still need to parse out the information I need, similar to the example you have pointed me at.
09-28-2016 07:10 AM
Hi,
As Steven stated, you can use the Time() and Date() functions and format the returned values into the desired format using the following expression:
Locals.Date = Date(False,Locals.Year,Locals.Month,Locals.Day), Locals.Time = Time(True,Locals.Hour,Locals.Minute,Locals.Second), Locals.FormattedDateTime = Str(Locals.Month, "%02s") + Str(Locals.Day, "%02s") + Right(Str(Locals.Year),2) + "-" + Str(Locals.Hour, "%02s") + ":" + Str(Locals.Minute, "%02s")
Regards,
Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)
Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor