$Date: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Mlarocca moved page $DATE to $Date: Lower case change)
No edit summary
Line 1: Line 1:
<p>The $DATE function returns an 8- or 10-character string equal to the current date in yy-mm-dd format (for example, 90-09-20) or yyyy-mm-dd format (for example, 1990-09-20). The default is 8 characters. If $DATE is stored as a field value, you can use this form to sort records chronologically. </p>
<p>The $Date function returns an 8- or 10-character string equal to the current date in yy-mm-dd format (for example, 90-09-20) or yyyy-mm-dd format (for example, 1990-09-20). The default is 8 characters. If $Date is stored as a field value, you can use this form to sort records chronologically. </p>
<b>Usage</b>
<b>Usage</b>
<p>When using $DATE in field values, make sure that all values of $DATE are in the same format. You will get incorrect results when sorting records if you mix yyyy and yy formats.        </p>
<p>When using $Date in field values, make sure that all values of $Date are in the same format. You will get incorrect results when sorting records if you mix yyyy and yy formats.        </p>
<b>Syntax</b>
<b>Syntax</b>
<p>The format for $DATE is:</p>
<p>The format for $Date is:</p>
<p class="code">$DATE(year-format,fill-character)
<p class="code">$Date(year-format,fill-character)
</p>
</p>
<p>See [[Overview of $DATE functions#Overview of $DATE functions|Overview of $DATE functions]] for syntax details.</p>
<p>See [[Overview of $Date functions#Overview of $Date functions|Overview of $Date functions]] for syntax details.</p>
<p>If <var class="product">Model&nbsp;204</var> encounters an error, the function returns all asterisks (*).</p>
<p>If <var class="product">Model&nbsp;204</var> encounters an error, the function returns all asterisks (*).</p>
<b>Example</b>
<b>Example</b>
<p>The following request prompts a user for data values and automatically stores the current date with each new record (using the 8-character format).</p>
<p>The following request prompts a user for data values and automatically stores the current date with each new record (using the 8-character format).</p>
<p class="code">BEGIN
<p class="code">BEGIN
%DATE = $DATE
%DATE = $date
GET.FIRST: %A = $READ('ENTER FIELD A')
GET.FIRST: %A = $READ('ENTER FIELD A')
           %B = $READ 'ENTER FIELD B')
           %B = $READ 'ENTER FIELD B')

Revision as of 15:32, 15 July 2014

The $Date function returns an 8- or 10-character string equal to the current date in yy-mm-dd format (for example, 90-09-20) or yyyy-mm-dd format (for example, 1990-09-20). The default is 8 characters. If $Date is stored as a field value, you can use this form to sort records chronologically.

Usage

When using $Date in field values, make sure that all values of $Date are in the same format. You will get incorrect results when sorting records if you mix yyyy and yy formats.

Syntax

The format for $Date is:

$Date(year-format,fill-character)

See Overview of $Date functions for syntax details.

If Model 204 encounters an error, the function returns all asterisks (*).

Example

The following request prompts a user for data values and automatically stores the current date with each new record (using the 8-character format).

BEGIN %DATE = $date GET.FIRST: %A = $READ('ENTER FIELD A') %B = $READ 'ENTER FIELD B') STORE RECORD FLD A = %A FLD B = %B . . . DATE STORED = %DATE END STORE IF $READ('NEXT RECORD: Y OR CR') EQ - 'Y' THEN JUMP TO GET.FIRST END IF END