$DateChk: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Mlarocca moved page $DATECHK to $DateChk: Lower case change)
m (more conversion cleanup)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<p>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.</p>
<p>
<b>Syntax</b>
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 $DATECHK function is:</p>
 
<p class="code">$DATECHK(format, date)  
==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>where:</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>
<td>DD</td>
<th>DD</th>
<td>Gregorian numeric day</td>
<td>Gregorian numeric day</td>
</tr>
</tr>
<tr>
<tr>
<td>DDD</td>
<th>DDD</th>
<td>Julian numeric date</td>
<td>Julian numeric date</td>
</tr>
</tr>
<tr>
<tr>
<td>MM</td>
<th>MM</th>
<td>Numeric month</td>
<td>Numeric month</td>
</tr>
</tr>
<tr>
<tr>
<td>MON</td>
<th>MON</th>
<td>Abbreviated month name</td>
<td>Abbreviated month name</td>
</tr>
</tr>
<tr>
<tr>
<td>MONTH</td>
<th>MONTH</th>
<td>Full month name</td>
<td>Full month name</td>
</tr>
</tr>
<tr>
<tr>
<td>YY</td>
<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>
<td>YYYY</td>
<th>YYYY</th>
<td>Full numeric year </td>
<td>Full numeric year </td>
</tr>
</tr>
<tr>
<tr>
<td>CYY</td>
<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>A format that has a month, day, and year element</p>
<p>
<p>A Julian date format that has a year element and a day element in the format DDD </p>
Any EBCDIC characters except single quotes are allowed within the format. The format can be as many as 32 characters in length. </p>
<p>Any EBCDIC characters except single quotes are allowed within the format. The format can be as many as 32 characters in length. </p>
<ul>
<li>date specifies a date in the format indicated by the format argument. The date can be as many as 36 characters in length. </li>
</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>
<b>Example</b>
 
<p class="code">PRINT $DATECHK('MON. DD, YYYY','FEB. 30, 1999')  
==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>
<p>prints the value 0 because the month of February does not have 30 days.  </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:
  • 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:

    • 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.

    Any EBCDIC characters except single quotes are allowed within the format. The format can be as many as 32 characters in length.

  • date specifies a date in the format indicated by the format argument. The date can be as many as 36 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')