$DateChk: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
<p>The $ | <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> | ||
<b>Syntax</b> | <b>Syntax</b> | ||
<p>The format of the $ | <p>The format of the $DateChk function is:</p> | ||
<p class="code">$ | <p class="code">$DateChk(format, date) | ||
</p> | </p> | ||
<p>where:</p> | <p>where:</p> | ||
Line 52: | Line 52: | ||
</ul> | </ul> | ||
<b>Example</b> | <b>Example</b> | ||
<p class="code">PRINT $ | <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> | <p>prints the value 0 because the month of February does not have 30 days. </p> | ||
[[Category:SOUL $functions]] | [[Category:SOUL $functions]] |
Revision as of 14:36, 16 July 2014
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
PRINT $datechk('MON. DD, YYYY','FEB. 30, 1999')
prints the value 0 because the month of February does not have 30 days.