Date/Time Format String Specifiers and Modifiers
LabWindows/CVI date/time format strings support the same format specifiers as strftime, with the %nf and @ extensions. The @ extension is valid only for the relative date/time format.
Absolute Date/Time Specifiers and Modifier
The following list describes the absolute date/time format string specifiers:
- %H—Hour in 24-hour format, also known as military time. Valid values are 00–23.
- %I—Hour in 12-hour format. Valid values are 01–12.
- %M—Minute, as an integer. Valid values are 00–59.
- %S—Second, as an integer. Valid values are 00–59.
- %nf—The fractional part of the seconds, rounded to n digits of precision, where n is an integer between 1 and 20. If you do not specify a value for n, LabWindows/CVI uses a default precision, which depends on how you use the format string. If you are formatting a graph or strip chart axis, LabWindows/CVI uses the precision specified for the axis. If you are using FormatDateTimeString, LabWindows/CVI uses 3 as the default number of digits.
- %p—AM/PM indicator for a 12-hour clock. The language settings that the operating system uses affect the value used.
- %b—Abbreviated month name.
- %B—Full month name.
- %m—Month, as an integer. Valid values are 01–12.
- %d—Day of the month, as an integer. Valid values depend on the month and year and range from 01 to 31.
- %j—Day of the year, as an integer. Valid values are 001–366.
- %a—Abbreviated weekday name.
- %A—Full weekday name.
- %w—Weekday, as an integer. Valid values are 0–6, where Sunday is 0.
- %U—Week of the year, as an integer, where Sunday is considered the first day of the week. Valid values are 00-53.
- %W—Week of the year, as an integer, where Monday is considered the first day of the week. Valid values are 00-53.
- %Y—Year with century, as an integer.
- %y—Year without century, as an integer. Valid values are 00–99.
- %x—Date representation based on the language settings that the operating system uses.
- %X—Time representation based on the language settings that the operating system uses.
- %c—Date and time representation based on the language settings that the operating system uses.
- %z, %Z—Time zone name or time zone abbreviation.
- %%—Percent sign.
LabWindows/CVI also supports the # modifier, which indicates to remove leading zeros. For example, if LabWindows/CVI displays %S as 04 for a particular data value, LabWindows/CVI displays %#S as 4 for that data value.
The following table displays absolute date/time format string specifiers and corresponding example values.
Specifiers | Example Value |
---|---|
%H:%M:%S | 03:59:45 |
%#H:%M:%S.%4f | 3:59:45.6789 |
%B:%d:%Y | December:31:1999 |
%B:%d:%y | December:31:99 |
%x | 12/31/1999 |
%X | 3:59:45 AM |
%c | 12/31/1999 3:59:45 AM |
Relative Date/Time Specifiers and Modifiers
The following list describes the relative date/time format string specifiers:
- %H—Number of hours since the reference point.
- %M—Number of minutes since the reference point.
- %S—Number of seconds since the reference point.
- %nf—The fractional part of the seconds since the reference point, rounded to n degrees of precision, where n is an integer between 1 and 20. If you do not specify a value for n, LabWindows/CVI uses the precision specified for the graph or strip chart axis.
- %X—Time since the reference point, based on the language settings that the operating system uses.
- %d—Number of days since the reference point.
LabWindows/CVI also supports the following modifiers:
- #—The # symbol indicates to remove any leading zeros. For example, if LabWindows/CVI displays %S as 04 for a particular data value, LabWindows/CVI displays %#S as 4 for that data value.
- @—The @ symbol indicates to restrict overflow. For example, if 70 seconds have elapsed since the reference point and you specify %S as the format string, the axis displays 70. However if you specify %@S as the format string, the axis displays 10. The seconds count starts over at 0 when the number of seconds reaches 60. The @ symbol restricts overflow for hours, minutes, and seconds only. It modifies the largest applicable time unit in the format string.
The following table displays relative date/time format string specifiers and modifiers and corresponding example values.
Specifiers/Modifiers | Example Value |
---|---|
%H | 99 |
%M | 5999 |
%S | 359985 |
%@S | 45 |
%f | 679 |
%@H:%M:%S.%4f | 03:59:45.6789 |
%X | 3:59:45 AM |
%d | 4 |
%d %#H:%M:%S | 4 3:59:45 |