DateCnv

Use this function to convert two-digit years into four-digit years.

Syntax

DateCnv (Date, Format, DivideYear, Century)

Parameter

Description

Date

Enter a date string. The system assumes your entry to be in the format specified in the Format parameter. The default is the current date.

Format

Enter a date format string that describes the contents of the Date parameter. The default is date format 1 (MM/DD/YY).

DivideYear

A dividing year value used to determine if the date value belongs to the specified century or the next. The default is the current year plus 40.

Century

The century to assign if the date falls in the dividing year. Otherwise, the result is this century plus one. The default is the current century.

Use this function to convert a date value to the proper century. The resulting date value will have a four-digit year. Since the system has no way of knowing whether a date represents a birthday (from the past) or a maturity date (in the future), a dividing year is required to make the century decision. If the dividing year is not provided, it will default using the equation ((current year + 40) % 100).

The century number is optional and defaults to the current century. If the two-digit year from the date value is greater than the dividing year, the system assumes the date is in the century given. Otherwise, the system assumes date is in the next century.

Example

Assume the current date is 07/01/99. This means the default dividing year is determined as: ((1999 + 40) % 100) = 39.

Note In this case, % means modulo, or modulus, which means the value that remains after dividing one number evenly into another. Here is an example: 100 divides into 2,035 twenty even times. 20 times 100 equals 2000. 2035 minus 2000 leaves 35. Therefore, 2035 % 100 = 35.

Function

Result

Explanation

Return(DateCnv( ))

07/01/1999

Defaults to the current date and format 1. Since 99 is greater than 39, this date assumes the current century.

Return(DateCnv ( "07/01/00" ))

07/01/2000

Since 00 is not greater than 39, this date assumes the next century.

Return(DateCnv ( "50/138" , "I", 50))

2050/138

The given date (50/138) in date format I is May 18, 50. Since 50 is not greater than the dividing year of 50, the result assumes the next century.

Return(DateCnv ( "99/138" , "I", 50))

1999/138

The given date (99/138) in date format I is May 18, 99. Since 99 is greater than the dividing year of 50, the result assumes the current century.

See also