Template:Datetime and format examples: Difference between revisions
(Created page with "<!-- transcluded by at least Sir2000 UL Tools and "Datetime string formats" --> <table class="thJustBold"> <tr><th>YYMMDD</th> <td>This is the common six-digit date format whi...") |
m (add some comments) |
||
Line 22: | Line 22: | ||
<tr><th>MM/DD/YY</th> | <tr><th>MM/DD/YY</th> | ||
<td>This is the U.S. six-digit date format for display. | <td>This is the U.S. six-digit date format for display. The value <code>12/14/97</code> matches this format. | ||
The following SOUL code fragment prints the value <code>OK</code> | <p> | ||
The following SOUL code fragment prints the value <code>OK</code>: | |||
</p> | |||
<p class="code">If $sir_date2nd('12/14/94', 'MM/DD/YY') > -9E12 Then | <p class="code">If $sir_date2nd('12/14/94', 'MM/DD/YY') > -9E12 Then | ||
Print 'OK' | Print 'OK' | ||
Line 31: | Line 33: | ||
<p class="code">print $sir_datechk('MM/DD/YY', '12/14/94') | <p class="code">print $sir_datechk('MM/DD/YY', '12/14/94') | ||
</p> | </p> | ||
<blockquote class="note"><b>Note: </b> With non-strict format matching, such as <var>$Sir_Date2nd</var>, the leading zero corresponding to an <var>MM</var> token may be given as a blank, thus allowing " 7/15/98". | <blockquote class="note"><b>Note: </b> With non-strict format matching, such as <var>$Sir_Date2nd</var>, the leading zero corresponding to an <var>MM</var> token may be given as a blank, thus allowing " 7/15/98". | ||
<p> | <p> | ||
With strict matching, however, such a leading blank is not allowed for <var>MM</var>. A leading blank month value with a strict $function (that is, one of the <var class="product">Sir2000 User Language Tools $functions</var>) requires the <var>BM</var> token.</p> | With strict matching, however, such a leading blank is not allowed for <var>MM</var>. A leading blank month value with a strict $function (that is, one of the <var class="product">Sir2000 User Language Tools $functions</var>) requires the <var>BM</var> token.</p> | ||
Line 39: | Line 41: | ||
<tr><th>DD.MM.YY</th> | <tr><th>DD.MM.YY</th> | ||
<td>This is a European six-digit date format for display. | <td>This is a European six-digit date format for display. The value <code>14.12.97</code> matches this format. | ||
The following SOUL code fragment prints the value <code>OK</code> | <p> | ||
The following SOUL code fragment prints the value <code>OK</code>: | |||
</p> | |||
<p class="code">If $sir_date2nd('14.12.94', 'DD.MM.YY') > -9E12 Then | <p class="code">If $sir_date2nd('14.12.94', 'DD.MM.YY') > -9E12 Then | ||
Print 'OK' | Print 'OK' | ||
Line 49: | Line 53: | ||
</p> | </p> | ||
<blockquote class="note"> | <blockquote class="note"> | ||
<b>Note:</b> With non-strict format matching, such as <var>$Sir_Date2nd</var>, the leading zero corresponding to a <var>DD</var> token may be given as a blank, thus allowing " 1.01.00". | <b>Note:</b> With non-strict format matching, such as <var>$Sir_Date2nd</var>, the leading zero corresponding to a <var>DD</var> token may be given as a blank, thus allowing " 1.01.00". | ||
<p> | <p> | ||
With strict matching, however, such a leading blank is not allowed for <var>DD</var>. A leading blank day value with a strict $function (that is, one of the <var class="product">Sir2000 User Language Tools Functions</var>) requires the <var>BD</var> token. </p> | With strict matching, however, such a leading blank is not allowed for <var>DD</var>. A leading blank day value with a strict $function (that is, one of the <var class="product">Sir2000 User Language Tools Functions</var>) requires the <var>BD</var> token. </p> | ||
Line 80: | Line 84: | ||
<tr><th>YYIIII</th> | <tr><th>YYIIII</th> | ||
<td>This format might be used for data that contains a two-digit year prefixing other information, such as a sequence number. | <td>This format might be used for data that contains a two-digit year prefixing other information, such as a sequence number. The value <code>92A123</code> matches this format. | ||
The following <var class="product">SOUL</var> code fragment prints the value <code>02</code>: | <p> | ||
The following <var class="product">SOUL</var> code fragment prints the value <code>02</code>: </p> | |||
<p class="code">%d = $sir_date2nd('92ABCD', 'YYIIII') | <p class="code">%d = $sir_date2nd('92ABCD', 'YYIIII') | ||
Print $sir_nd2date(%d + 10*365.25, 'YY') </p> | Print $sir_nd2date(%d + 10*365.25, 'YY') </p> | ||
Line 94: | Line 99: | ||
<tr><th>YY*</th> | <tr><th>YY*</th> | ||
<td>This format might be used for data that contains a two-digit year prefixing other information, such as a sequence number, when the other information is variable length. | <td>This format might be used for data that contains a two-digit year prefixing other information, such as a sequence number, when the other information is variable length. The values <code>92</code> and <code>92ABC123</code> match this format. | ||
<p> | <p> | ||
The following <var class="product">SOUL</var> code fragment | The following <var class="product">SOUL</var> code fragment | ||
Line 123: | Line 128: | ||
<tr><th>CYYDDD</th> | <tr><th>CYYDDD</th> | ||
<td>This is a compact six-digit date format with explicit century information, from 1900 through and including 2899. | <td>This is a compact six-digit date format with explicit century information, from 1900 through and including 2899. The value <code>097031</code> (representing 31 January 1997) matches this format. | ||
The following <var class="product">SOUL</var> fragment prints the value <code>OK</code>: | <p> | ||
The following <var class="product">SOUL</var> fragment prints the value <code>OK</code>: </p> | |||
<p class="code">If $sir_date2nd('097031', 'CYYDDD') > -9E12 Then | <p class="code">If $sir_date2nd('097031', 'CYYDDD') > -9E12 Then | ||
Print 'OK' | Print 'OK' | ||
Line 133: | Line 139: | ||
<tr><th>ZYYMMDD</th> | <tr><th>ZYYMMDD</th> | ||
<td>This is a compact six- or seven-digit date format with explicit century information, from 1900 through and including 2899, that can often be used with "old" <var>YYMMDD</var> date values in the 1900s. | <td>This is a compact six- or seven-digit date format with explicit century information, from 1900 through and including 2899, that can often be used with "old" <var>YYMMDD</var> date values in the 1900s. The values <code>970501</code> (representing 1 May 1997) and <code>1000501</code> (representing 1 May 2000) match this format. | ||
The following <var class="product">SOUL</var> fragment prints the values <code>OK</code> and <code>OK</code>: | <p> | ||
The following <var class="product">SOUL</var> fragment prints the values <code>OK</code> and <code>OK</code>: </p> | |||
<p class="code">* Check 1 Dec, 1997: | <p class="code">* Check 1 Dec, 1997: | ||
If $sir_date2nd('971201', 'ZYYMMDD') > -9E12 Then | If $sir_date2nd('971201', 'ZYYMMDD') > -9E12 Then | ||
Line 161: | Line 168: | ||
<tr><th>YY0000</th> | <tr><th>YY0000</th> | ||
<td>Decimal digits can be used as separator characters. | <td>Decimal digits can be used as separator characters. The value <code>980000</code> matches this format. | ||
The following <var class="product">SOUL</var> fragment prints the value <code>1992NA</code>: | <p> | ||
The following <var class="product">SOUL</var> fragment prints the value <code>1992NA</code>: </p> | |||
<p class="code">%n = $sir_date2nd('92000', 'YY000') | <p class="code">%n = $sir_date2nd('92000', 'YY000') | ||
Print $sir_nd2date(%n, 'YYYY"N"A') </p> | Print $sir_nd2date(%n, 'YYYY"N"A') </p> |
Latest revision as of 20:18, 9 February 2018
YYMMDD | This is the common six-digit date format which supports sort order if all dates are within a single century.
The following SOUL code fragment prints the value If $sir_date2nd('960229', 'YYMMDD') > -9E12 Then Print 'OK' End If
For Sir2000 User Language Tools users, the following statement prints the value print $sir_datechk('YYMMDD', '960229') |
---|---|
YYYYMMDD | This is the common eight-digit date format which supports sort order with dates in two centuries.
The following SOUL code fragment prints the value %n = $sir_date2nd('921212', 'YYMMDD') Print $sir_nd2date(%n, 'YYYYMMDD')
For Sir2000 User Language Tools users, the following statement prints the value print $sir_datecnv('YYMMDD', 'YYYYMMDD', '921212') |
MM/DD/YY | This is the U.S. six-digit date format for display. The value 12/14/97 matches this format.
The following SOUL code fragment prints the value If $sir_date2nd('12/14/94', 'MM/DD/YY') > -9E12 Then Print 'OK' End If
For Sir2000 User Language Tools users, the following statement prints the value print $sir_datechk('MM/DD/YY', '12/14/94')
|
DD.MM.YY | This is a European six-digit date format for display. The value 14.12.97 matches this format.
The following SOUL code fragment prints the value If $sir_date2nd('14.12.94', 'DD.MM.YY') > -9E12 Then Print 'OK' End If
For Sir2000 User Language Tools users, the following statement prints the value print $sir_datechk('DD.MM.YY', '14.12.94')
|
Wkday, DAY Month YYYY "A"T HH:MI | This is a format that could be used for report headers.
The following SOUL statement prints a value like print $sir_date('Wkday, DAY Month YYYY "A"T HH:MI')
|
YYIIII | This format might be used for data that contains a two-digit year prefixing other information, such as a sequence number. The value 92A123 matches this format.
The following SOUL code fragment prints the value %d = $sir_date2nd('92ABCD', 'YYIIII') Print $sir_nd2date(%d + 10*365.25, 'YY')
For Sir2000 User Language Tools users, the following statement prints the value print $sir_datecnv('YYIIII', 'YYYYIIII', '92ABCD') Note: When a pair of format strings are used for transforming date values, for example for $Sir_DateCnv or processing of updates to SIRFIELD RELATE fields, both formats must have the same number of I tokens. The $functions with both an input and output format, for example $Sir_DateCnv, are only available in the Sir2000 User Language Tools; SIRFIELD is part of the Sir2000 Field Migration Facility. |
YY* | This format might be used for data that contains a two-digit year prefixing other information, such as a sequence number, when the other information is variable length. The values 92 and 92ABC123 match this format.
The following SOUL code fragment
prints the values If $sir_date2nd('92', 'YY*') > -9E12 Then Print 'OK' End If IF $sir_date2nd('1992ABC', 'YYYY*') > -9E12 THEN Print 'OK' End If
For Sir2000 User Language Tools users, the following statements print the values print $sir_datecnv('YY*', 'YYYY*', '92') print $sir_datecnv('YY*', 'YYYY*', '92XYZ')
|
CYYDDD | This is a compact six-digit date format with explicit century information, from 1900 through and including 2899. The value 097031 (representing 31 January 1997) matches this format.
The following SOUL fragment prints the value If $sir_date2nd('097031', 'CYYDDD') > -9E12 Then Print 'OK' End If
For Sir2000 User Language Tools users, the following statement prints the value print $sir_datechk('CYYDDD', '097031') |
ZYYMMDD | This is a compact six- or seven-digit date format with explicit century information, from 1900 through and including 2899, that can often be used with "old" YYMMDD date values in the 1900s. The values 970501 (representing 1 May 1997) and 1000501 (representing 1 May 2000) match this format.
The following SOUL fragment prints the values * Check 1 Dec, 1997: If $sir_date2nd('971201', 'ZYYMMDD') > -9E12 Then Print 'OK' End If * Check 1 Dec, 2000: If $sir_date2nd('1001201', 'ZYYMMDD') > -9E12 Then Print 'OK' End If
For Sir2000 User Language Tools users, the following statements print the values * Check 1 Dec, 1997: print $sir_datechk('ZYYMMDD', '971201') * Check 1 Dec, 2000: print $sir_datechk('ZYYMMDD', '1001201')
|
YY0000 | Decimal digits can be used as separator characters. The value 980000 matches this format.
The following SOUL fragment prints the value %n = $sir_date2nd('92000', 'YY000') Print $sir_nd2date(%n, 'YYYY"N"A')
For Sir2000 User Language Tools users, the following SOUL statement prints the value Print $sir_datecnv('YY0000', 'YYYY"N"A', '920000') Note: Numeric separators, unlike alphabetic separators, do not need to be preceded by a double-quote character ("). |