Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Command Index > S > SET

DATE

Scroll Prev Top Next More

Operating Condition

 

Syntax:  SET DATE CENTURY value

            SET DATE YEAR value

            SET DATE MM/DD/YY (date sequence and format)

            SET DATE SEQ MMDDYY (date sequence)

            SET DATE FOR MM/DD/YY (date format)

 

SET DATE sets the date sequence for entry, and format for display. A valid date can have up to 30 characters. R:BASE stores the setting with the database.

 

Use the SET DATE CENTURY value command to set the default century (the first two digits of a four-digit year). For example, if you enter a two-digit year and you want it to default to the twenty-first century, enter the following command:

 

SET DATE CENTURY 20

 

A year such as "25" would be stored as "2025."

 

Use the SET DATE YEAR value command to have two default centuries for dates entered, depending on the year. All years from 00 to (YEAR value-1) are stored with the next century (CENTURY value+1), and all years from value to 99 are stored with the default century (CENTURY value). For example, you can have all dates from the year 50 to 99 default to the twentieth century, and all dates from 00 to 49 default to the twenty-first century by entering the following commands:

 

SET DATE CENTURY 19

SET DATE YEAR 50

 

The SET DATE CENTURY 19 command sets the default century to 19. The SET DATE YEAR 50 command stores all years from 50 to 99 with the default century, 19. All dates from 0 to 49 are stored with the next century, 20. Therefore, years entered from 50 to 99 are stored as 1950 to 1999, and years entered from 00 to 49 are stored as 2000 to 2049.

 

Note: The DATE CENTURY and DATE YEAR options are only effective when the DATE SEQUENCE includes a two-digit year (MMDDYY, DDMMYY, etc.).

 

R:BASE accepts a date between January 1, 3999 BC and December 31, 9999 AD. You can set the date sequence and format separately. R:BASE displays the date based on the format. When setting the format to display numerals for the month, day, and year, use a separator such as the slash (/), hyphen (-), comma (,) or space (blank). For example, if you set the date format to MM/DD/YY and enter 061193, R:BASE displays 06/11/93.

 

You can also include text for the weekday and month in the date format to a maximum of 30 characters. Include WWW for a three-letter day abbreviation, WWW+ for the full day name, MMM for a three-letter month abbreviation, and MMM+ for the full month name. If the date format contains spaces or commas, enclose the format in quotes. For example, if the special character for QUOTES is set to the R:BASE default ('), the format 'MMM DD, YYYY CC' displays Jun 11, 1993 AD.

 

If you use YY in the date format, R:BASE displays only the last two digits of the year. To view dates in other centuries, use a date format with a four-digit year such as 'MM DD, YYYY'. If you use BC dates, add CC to the format. Dates entered with BC are shown with BC; otherwise, the date is shown with AD. For example, you could use the sequence MMDDYY and the format 'MMM DD, YYYY CC' to accept and display BC dates. If you enter '06 11 93BC,' R:BASE displays Jun 11, 0093 BC.

 

Example: Valid date formats, using June 11, 1993

Date Format

Display

'MMM+ DD' MM/YY

June 11 06/93

'WWW the DD' 'WWW+, MMM+ DD, YYYY CC'

Sun the 11 Sunday, June 11, 1993 AD

 

You can omit the SEQ and FOR keywords to set both sequence and format in a single SET DATE command. For example, enter SET DATE MM/DD/YYYY to set both date sequence and format to a four-digit year.

 

Enter the date in any form as long as the sequence of M's, D's, Y's, and C's are in the same order defined for the date sequence. The display, however, is always exactly as defined by the DATE format.

 

If, for example, you set the date sequence to a four-digit year with SET DATE SEQ MMDDYYYY, set the date format to a two-digit year with SET DATE FOR MM/DD/YY, and later enter a two-digit year, R:BASE will store and might display a date you do not expect. As the following table shows, if you enter 06/11/93, R:BASE stores the date as 06/11/0093 and displays 06/11/93.

 

How R:BASE stores and displays dates

DATE Sequence

Date Entered

Date Stored

MMDDYYYY

6/11/93

06/11/0093

MMDDYY

6/11/0093

06/11/1993

MMYY

6/11

06/01/1993

MMDD

6/11

06/11/1993

DDYY

6/11

01/06/1911

DDYY

11/93

01/11/1993

 

DATE Format (2-digit Year)

DATE Format (4-digit Year)

06/11/93

06/11/0093

06/11/93

06/11/1993

06/01/93

06/01/1993

06/11/93

06/11/1993

01/06/11

01/06/1911

01/11/93

01/11/1993

 

If the sequence is set to a four-digit year and the format is set to a two-digit year, R:BASE stores the date you enter, such as 06/11/95, as a four-digit year. As a result, if you use a WHERE clause to display rows that have dates greater than 06/11/95, R:BASE returns all rows greater than 06/11/0095.

 

The DATE format can affect date functions. For best results, set the format to the default MM/DD/YY and then use a date function.