Optional time format qualifiers
You can specify the optional format qualifiers immediately after the % symbol of the formatting directive.
A time format qualifier defines a field specification for the time (or date and time) that the HCL OneDB™ product reads or prints. This section describes what a field specification means for the print operation. For a description of what a field specification means for the read operation, see Field specification for reading a DATE value.
- Element
- Description
- - (minus sign)
- HCL OneDB product prints the field value as left-aligned and pads this value with spaces on the right.
- 0 (zero)
- HCL OneDB product prints the field value as right-aligned and pads this value with zeros on the left.
- width
- Integer that indicates a minimum field width for the printed value.
- precision
- Integer that indicates the precision to use for the field value.
The first character of the field specification indicates whether to justify or pad the field value. If the first character is not a minus sign or a zero, the HCL OneDB product prints the field value as right-aligned and pads this value with spaces on the left.
Formatting directives | Description |
---|---|
%F, %H, %I, %M, %S | Value of precision specifies the minimum number of digits to print. If a value supplies fewer digits than the precision specifies, the HCL OneDB product pads the value with leading zeros. The %H, %M, and %S formatting directives have a default precision of 2. |
%p | Value of precision specifies the maximum number of characters to print. If a value supplies more characters than the precision specifies, the HCL OneDB product truncates the value. |
%R, %T | Values of width and precision affect each element of these formatting directives. For example, the field specification %6.4R causes a DATETIME value to be displayed if the format were %6.4H:%6.4M. Here no fewer than four (but no more than six) characters represented the hour and the minute. |
%F | Value of precision can follow this directive as an optional precision specification. This value must be 1 - 5. Otherwise, the HCL OneDB product generates an error. This precision value overrides any precision value that you specify between the % symbol and the formatting directive. |
%Ox | For formatting directives that include the O modifier, value of precision is still the minimum number of digits to print. The width value defines the format width, rather than the actual number of digits. |
%c, %Ec, %EX, %X | Values of width and precision have no effect on these formatting directives. |
For example, the following formatting directive displays
the minute as an integer with a maximum field width of 4
: %4M
The
following formatting directive displays the hour as an integer with
a minimum field width of 3
and a maximum field width
of 6
: %6.3H
%Y/%m/%d %H:%M:%S
' This setting would cause a value
from a DATETIME YEAR TO SECOND column to be displayed as follows:[2000/08/28 14:43:17]
[2000/08/28 14:43:17]
When GL_DATETIME is set, every DATETIME value is displayed in the specified format, even if that format includes time units that were not included in the DATETIME qualifier when the data type was declared. Time units outside the declared precision are obtained from the system clock-calendar. To avoid unexpected results, you might prefer to set GL_DATETIME only for applications where the DATETIME data types that you display have the same precision as the GL_DATETIME setting.