$DateChk: Difference between revisions
Jump to navigation
Jump to search
(Automatically generated page update) |
m (more conversion cleanup) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
<p>The $ | <p> | ||
The <var>$DateChk</var> function determines whether a given date is valid. <var>$DateChk</var> returns a 1 if the date is valid. A 0 is returned if either the date is invalid or if the date does not match a format you specify.</p> | |||
<p>The format of the $ | |||
<p class=" | ==Syntax== | ||
<p> | |||
The format of the <var>$DateChk</var> function is:</p> | |||
<p class="syntax">$DateChk(<span class="term">format</span>, <span class="term">date</span>) | |||
</p> | </p> | ||
<p> | <p>Where:</p> | ||
<ul> | <ul> | ||
<li>format specifies the format of the date, which can be a combination of the following elements:</li> | <li><var class="term">format</var> specifies the format of the date, which can be a combination of the following elements:</li> | ||
<table> | <table class="thJustBold"> | ||
<tr> | <tr> | ||
< | <th>DD</th> | ||
<td>Gregorian numeric day</td> | <td>Gregorian numeric day</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
< | <th>DDD</th> | ||
<td>Julian numeric date</td> | <td>Julian numeric date</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
< | <th>MM</th> | ||
<td>Numeric month</td> | <td>Numeric month</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
< | <th>MON</th> | ||
<td>Abbreviated month name</td> | <td>Abbreviated month name</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
< | <th>MONTH</th> | ||
<td>Full month name</td> | <td>Full month name</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
< | <th>YY</th> | ||
<td>Last two digits of numeric year (assumes that the year prefix is 19)</td> | <td>Last two digits of numeric year (assumes that the year prefix is 19)</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
< | <th>YYYY</th> | ||
<td>Full numeric year </td> | <td>Full numeric year </td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
< | <th>CYY</th> | ||
<td>The century, plus the year. Century (C) is a single digit, where 0 represents 1900, 1 represents 2000, and so on.</td> | <td>The century, plus the year. Century (C) is a single digit, where 0 represents 1900, 1 represents 2000, and so on.</td></tr> | ||
</tr> | |||
</table> | </table> | ||
<p>Valid formats are:</p> | <p> | ||
</li> | Valid formats are:</p> | ||
<ul> | |||
<li>A format that has a month, day, and year element.</li> | |||
<li>A Julian date format that has a year element and a day element in the format DDD. </li> | |||
</ul> | </ul> | ||
< | <p> | ||
Any EBCDIC characters except single quotes are allowed within the format. The format can be as many as 32 characters in length. </p> | |||
</li> | </li> | ||
<li><var class="term">date</var> specifies a date in the format indicated by the <var class="term">format</var> argument. The date can be as many as 36 characters in length. </li> | |||
</ul> | </ul> | ||
< | |||
<p class="code">PRINT $ | ==Example== | ||
<p> | |||
The following statement prints the value 0, because the month of February does not have 30 days. </p> | |||
<p class="code">PRINT $datechk('MON. DD, YYYY','FEB. 30, 1999') | |||
</p> | </p> | ||
[[Category:SOUL $functions]] | [[Category:SOUL $functions]] |
Latest revision as of 19:24, 23 September 2015
The $DateChk function determines whether a given date is valid. $DateChk returns a 1 if the date is valid. A 0 is returned if either the date is invalid or if the date does not match a format you specify.
Syntax
The format of the $DateChk function is:
$DateChk(format, date)
Where:
- format specifies the format of the date, which can be a combination of the following elements:
- A format that has a month, day, and year element.
- A Julian date format that has a year element and a day element in the format DDD.
- date specifies a date in the format indicated by the format argument. The date can be as many as 36 characters in length.
DD | Gregorian numeric day |
---|---|
DDD | Julian numeric date |
MM | Numeric month |
MON | Abbreviated month name |
MONTH | Full month name |
YY | Last two digits of numeric year (assumes that the year prefix is 19) |
YYYY | Full numeric year |
CYY | The century, plus the year. Century (C) is a single digit, where 0 represents 1900, 1 represents 2000, and so on. |
Valid formats are:
Any EBCDIC characters except single quotes are allowed within the format. The format can be as many as 32 characters in length.
Example
The following statement prints the value 0, because the month of February does not have 30 days.
PRINT $datechk('MON. DD, YYYY','FEB. 30, 1999')