Sumit,
The format strings help document is not related to the Str() function.I can see why you got confused though.The Format Strings listed in that document are used in your system regional and languages options.Start->Control Panel->Regional and Language Options ->Customize.If you change those settings, it will affect the way your entire system displays date and time.That also will affect the way TestStand displays the standard date and time.
Going back to the string formatting issue:
The correct way to format your string will be the following:
Locals.Header = "Test Start Time: " + Str(Locals.StartDate.Month,"%02u") + "-" + Str(Locals.StartDate.MonthDay,"%02u") + "-" + Right(Str(Locals.StartDate.Year,"%u"),2) + " " + Str(Locals.StartTime.Hour,"%02u") + ":" + Str(Locals.StartTime.Minutes,"%02u") + ":" + Str(Locals.StartTime.Seconds,"%02u") +"\n"
Notice that the format string is "%02u". It indicates that the width should be always 2 and if it is less than 2 it should prefix 0's.Check the "printf" documentation for more information: <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_printf.2c_.wprintf.asp" target="_blank">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_printf.2c_.wprintf.asp</a> Notice that I used the "Right()" function instead of the "Mid()" function.I am also attaching a TestStand 3.0 sequence file that uses the "Time()" and "Date()" functions to obtain the current time.I save them under local container variables similar to yours and finally format them using the previous expression.
Hope it helps.
If you have any question let me know.
Antonio Lie.Message Edited by Antonio Lie (NI) on 03-21-2006 12:24 PM
FormattingExample30.seq:
http://forums.ni.com/attachments/ni/330/10265/1/FormattingExample30.seq