GETDATE - ***OBSOLETE*** use .TOSEC and .TFMT.

Alternate entries: GT.DAT

Usage:

B:
   status = getdate( string [, tense] );
C:
   int getdate(const char *string [, int tense] );

Where:

string
is a pointer to the ASCII string to be converted. This string is replaced by the formatted date once conversion has taken place.
tense
indicates what year to put down if a year is not specified in "string". If "tense" is 0, GETDATE uses the year closest to the current date. If "tense" is -1, GETDATE chooses the most recent date in the past, and if "tense" is +1, GETDATE chooses the closest date in the future.

For example, suppose string is "January 10". If "tense" is -1, GETDATE interprets this as last January 10; if "tense" is +1, GETDATE interprets this as next January 10; if "tense" is 0, GETDATE interprets this as whichever January 10 is closer to today.

status
is a number that indicates what GETDATE has done to "string". The possible values for status are:
3
a unique date was recognized and returned.
2
a date was returned but the month and the day might have been confused as in "06/10/80". The month is assumed to have come first.
0
no date was recognized and the original string was left unchanged.

Description:

GETDATE attempts to convert the ASCII date in "string" into the form "mm/dd/yy". GETDATE allows for a great deal of variation in the input format of "string", and will recognize the months of the year spelled out, abbreviated, or in roman numerals. GETDATE also recognizes correct ordinal suffixes, definite articles, and prepositions.

If "string" does not contain a recognizable year, GETDATE will supply one based on the argument "tense".

Below we list some examples of GETDATE. In all cases, "tense" is assumed to be zero.

Examples:

In 1999:
   string         changed to:    status
   012181         01/21/81         3
   02  11 1965    02/11/65         2
   sep 3          09/03/99         3
   garbage        garbage          0
   3 blat 56      3 blat 56        0
on nov the 1st    11/01/99         3
5th of july 1970  07/05/70         3

Notes:

This version of GETDATE is written by using the .TOSEC function. For full information on the types of date strings recognized by GETDATE, see "expl b lib .tosec". However, since GETDATE is only concerned with dates, none of the .TOSEC features related to time of day may appear in "string". Furthermore, GETDATE does not accept relative dates, such as "10 days ago".

Earlier versions of GETDATE did not use .TOSEC; therefore there are subtle differences between the current version of GETDATE and earlier versions. In particular, earlier versions handled "tense" differently:

In addition, GETDATE used to accept dates that used the colon (:) character, as in 99:12:25 for Christmas, 1999. This construction is no longer valid, since .TOSEC associates the colon exclusively with times.

See Also:

expl b lib .tosec

expl b lib .tfmt

expl b lib date

expl b lib datesi

expl b lib datev

Copyright © 2000, Thinkage Ltd.