The C() format code is used to transfer calendar (Julian date and/or time) data.
The syntax is:
[n]C([c0,c1,...,cx])
where the parameter "n" is as described in Syntax of Format Codes and:
|
ci
|
represents optional calendar format subcodes, or any of the standard format codes that are allowed within a calendar specification, as described below
|
If no ci are provided, the data will be transferred using the standard 24-character system format that includes the day, date, time, and year, as shown in this string:
Thu Aug 13 12:01:32 1979
For input, this default is equivalent to:
C(CDwA, X, CMoA, X, CDI, X, CHI, X, CMI, X, CSI, CYI5)
For output, this default is equivalent to:
C(CDwA, X, CMoA, X, CDI2.2, X, CHI2.2, ":", CMI2.2, ":", CSI2.2, CYI5)
| Note |
| Note |
| Note |
The following is a list of the subcodes allowed within the parenthesis of the C() format code.
| Note |
The CMOA subcodes transfers the month portion of a date as a string. The format for an all upper case month string is:
CMOA[-][w]
The format for a capitalized month string is:
CMoA[-][w]
The format for an all lower case month string is:
CmoA[-][w]
where:
|
w
|
is an optional width (0 £ w £ 256) specifying the number of characters of the month name to be transferred. If w is not specified, three characters will be transferred. See Padding and Natural Width Formatting for additional details on the output width of a formatted value.
|
| Note |
The CMOI subcode transfers the month portion of a date as an integer. The format is as follows:
CMOI[+][-][w][.m]
where:
|
w
|
is an optional width (0 £ w £ 256) specifying the width of the field in characters. The default width is 2. See Padding and Natural Width Formatting for additional details on the output width of a formatted value.
|
|
m
|
is an optional minimum number (1 £ m £ 256) of nonblank digits to be shown on output. The field is zero-filled on the left if necessary. If m is omitted or zero, the output is padded with blanks to achieve the specified width.
Note - The m parameter is ignored if w is zero.
|
The CDI subcode transfers the day portion of a date as an integer. The format is:
CDI[+][-][w][.m]
where:
|
w
|
is an optional width (0 £ w £ 256) specifying the width of the field in characters. The default width is 2. See Padding and Natural Width Formatting for additional details on the output width of a formatted value.
|
|
m
|
is an optional minimum number (1 £ m £ 256) of nonblank digits to be shown on output. The field is zero-filled on the left if necessary. If m is omitted or zero, the output is padded with blanks to achieve the specified width.
Note - The m parameter is ignored if w is zero.
|
The CYI subcode transfers the year portion of a date as an integer. The format is as follows:
CYI[+][-][w][.m]
where:
|
w
|
is an optional width (0 £ w £ 256) specifying the width of the field in characters. The default width is 4. See Padding and Natural Width Formatting for additional details on the output width of a formatted value.
|
|
m
|
is an optional minimum number (1 £ m £ 256) of nonblank digits to be shown on output. The field is zero-filled on the left if necessary. If m is omitted or zero, the output is padded with blanks to achieve the specified width.
Note - The m parameter is ignored if w is zero.
|
The CHI subcodes transfer the hour portion of a date as an integer. The format for a 24-hour based integer is:
CHI[+][-][w][.m]
The format for a 12 hour based integer is:
ChI[+][-][w][.m]
where:
|
w
|
is an optional width (0 £ w £ 256) specifying the width of the field in characters. The default width is 2. See Padding and Natural Width Formatting for additional details on the output width of a formatted value.
|
|
m
|
is an optional minimum number (1 £ m £ 256) of nonblank digits to be shown on output. The field is zero-filled on the left if necessary. If m is omitted or zero, the output is padded with blanks to achieve the specified width.
Note - The m parameter is ignored if w is zero.
|
The CMI subcode transfers the minute portion of a date as an integer. The format is:
CMI[+][-][w][.m]
where:
|
w
|
is an optional width (0 £ w £ 256) specifying the width of the field in characters. The default width is 2. See Padding and Natural Width Formatting for additional details on the output width of a formatted value.
|
|
m
|
is an optional minimum number (1 £ m £ 256) of nonblank digits to be shown on output. The field is zero-filled on the left if necessary. If m is omitted or zero, the output is padded with blanks to achieve the specified width.
Note - The m parameter is ignored if w is zero.
|
The CSI subcode transfers the seconds portion of a date as an integer. The format is:
CSI[+][-][w][.m]
where:
|
w
|
is an optional width (0 £ w £ 256) specifying the width of the field in characters. The default width is 2. See Padding and Natural Width Formatting for additional details on the output width of a formatted value.
|
|
m
|
is an optional minimum number (1 £ m £ 256) of nonblank digits to be shown on output. The field is zero-filled on the left if necessary. If m is omitted or zero, the output is padded with blanks to achieve the specified width.
Note - The m parameter is ignored if w is zero.
|
The CSF subcode transfers the seconds portion of a date as a floating-point value. The format is:
CSF[+][-][w][.d]
where:
|
w
|
is an optional width specification (0 £ w £ 256). The variable w specifies the number of characters in the external field; the default is 5. See Padding and Natural Width Formatting for additional details on the output width of a formatted value.
|
|
d
|
is an optional width specification (1 £ d < w). The variable d specifies the number of positions after the decimal point; the default is 2.
|
The value of w must be large enough to include at least one digit to the left of the decimal point, the decimal point, and d digits to the right of the decimal point. On output, if the field provided is not wide enough, it is filled with asterisks (*) to indicate the overflow condition.
The CDWA subcodes transfers the day of week portion of a data as a string. The format for an all upper case day of week string is:
CDWA[-][w]
The format for a capitalized day of week string is:
CDwA[-][w]
The format for an all lower case day of week string is:
CdwA[-][w]
where:
|
w
|
is an optional width (0 £ w £ 256), specifying the number of characters of the day of week name to be transferred. If w is not specified, three characters will be transferred. See Padding and Natural Width Formatting for additional details on the output width of a formatted value.
|
| Note |
The CAPA subcodes transfers the am or pm portion of a date as a string. The format for an all upper case AM or PM string is:
CAPA[-][w]
The format for a capitalized AM or PM string is:
CApA[-][w]
The format for an all lower case AM or PM string is:
CapA[-][w]
where:
|
w
|
is an optional width (0 £ w £ 256), specifying the number of characters of the AM or PM string to be transferred. If w is not specified, two characters will be transferred. See Padding and Natural Width Formatting for additional details on the output width of a formatted value.
|
| Note |
None of these subcodes are allowed outside of a C() format specifier. In addition to the subcodes listed above, only quoted strings, "TL", "TR", and "X" format codes are allowed inside of the C() format specifier.
To print the current date in the default format:
PRINT, FORMAT='(C())', SYSTIME(/JULIAN)
The printed result should look something like:
Fri Aug 14 12:34:14 1998
To print the current date as a two-digit month value followed by a slash followed by a two-digit day value:
PRINT, FORMAT='(C(CMOI,"/",CDI))',SYSTIME(/JULIAN)
The printed result should look something like:
8/14
To print the current time in hours, minutes, and floating-point seconds, all zero-filled if necessary, and separated by colons:
PRINT, $ FORMAT='(C(CHI2.2,":",CMI2.2,":",CSF05.2))',SYSTIME(/JULIAN)
The printed result should look something like:
09:59:07.00
Note that to do zero-filling for the floating-point seconds, it is necessary to specify a leading 0 in the width to the CSF format code.