First year of 20th century property

Official Content
This documentation is valid for:
When using two-digit numbers, it indicates GeneXus if they belong to the 20th or to the 21st century.

Scope

Platforms: Web(.Net, Java)

Description

The programs generated by GeneXus require the user to enter only the last two digits of the year, but they internally store them in a full four-digit format. If the entered number is less than 40 (iSeries default), the year is assumed to be in the 21st century (not the 20th). That is, it is not possible for the user to type in a date prior to 1940.

This property will indicate GeneXus that the two-digit number still belongs to the 20th century. Two-digit numbers lower than the default value will be considered as belonging to the 21st century.

Values

Any value between 00 and 99.

Default Value: it depends on the selected generator. They are as follows:

  •    Cobol, RPG, .NET, and Java generators: 40
  •    Visual FoxPro generator: 0

Samples

10 is set as the year starting the 20th century. This tells GeneXus that if the user types in a number greater than or equal to 10 for a given year, it will be assumed that the date belongs to the 20th century (i.e. 10 means 1910, 70 means 1970, 07 means 2007).

Note:

This option does not apply to any internal date calculations, which are always performed on a full four-digit year basis.

Once a date is shown in the form using two digits, it is handled using the definition of this property. This is because the user cannot distinguish between 1927 and 2027 and assumes 1927 for consistency.

Event Start
    &Fecha2dig = ymdtod(1927,4,5)   // Date with Picture 99/99/99
    &Fecha4dig = ymdtod(1927,4,5)   // Date with Picture 99/99/9999
    msg(&Fecha2dig.Year().ToString()) //Shows 1927
    msg(&Fecha4dig.Year().ToString()) //Shows 1927
EndEvent

Event Enter
    //&Fecha2dig and &Fecha4dig are on the form
    &year2=&Fecha2dig.Year() //Shows 2027
    &year4=&Fecha4dig.Year() //Shows 1927
Endevent

So, the best user experience is when years are shown in a four-digit format.

How to apply changes

To apply the corresponding changes when the property value is configured, execute a Build with this Only of the object.

See Also

Date format in CTOD function property
Time format property