Date (internal function): Difference between revisions
Gordon.dye (talk | contribs) m (→Parameters) |
m (1 revision) |
(No difference)
|
Revision as of 14:11, 15 January 2012
See also Date (disambiguation)
The Date function calculates and returns dates in numeric format, using no dashes or slashes as separators. The "C" - century format specification is now fully supported. If the century is not specified, it is simply not printed.
Examples
PRINT DATE$("M/D/CY")
output: 07/10/1992
PRINT DATE$(Days(07101992,"MDCY"),"M/D/Y")
output: 07/10/92
PRINT DATE$(Days(07102092,"MDCY"),"M/D/Y")
output: 07/10/92
The DATE function should not be confused with the DATE command, which may be used to reset or display the current system date.
Comments and Examples
00010 PRINT FIELDS "10,10,cr 20": "Enter Posting Date:" 00020 PRINT FIELDS "10,43,n 6,r": DATE("mmddyy") 00030 INPUT FIELDS "10,43,n 6,r3": POSTDATE
Line 20 displays the current system date as a number in the format month, day and year. Line 30 positions the cursor to the third digit and allows the operator the option to change the displayed date by typing over all or part of it.
Parameters
The DATE function cannot be used in READY mode unless it includes parameters. If you type in "DATE" and press <CR>, you will be using the DATE command (which uses a different default format than the DATE function does).
The optional "days" parameter represents the desired date as a sequential value in relation to a base date of January 1, 1900. Thus January 1, 1900 would have a days value of 1; January 1, 1901 would have a days value of 366 (1900 was not a leap year).
The optional "format$" parameter is a string expression which identifies the format of the value to be returned. When the first character of the string expression is an asterisk (*), it identifies the default format which should be used by the DATE, DATE$ and Days parameters until the workstation exits Business Rules until the format is changed again. (Format changes affect the current workstation only.)
The format$ parameter may include editing characters (which are ignored by DATE) and any of the following date specifications: D (day), M (month), Y (year) or C (century). The total number of editing characters and date specifications may not exceed 6. Consecutive repetitions (DDD, YY, etc.) of the date specifications count as just one specification. See the DATE$ function for additional information about format$.
Related Functions
See also Date$ and Days] for other date processing functions. To set the system date, use the Date command. For features especially useful in markets outside the United States, see the INVP parameter of the Option statement and the Pic$ function in the Format Specifications.