When the system property 'glide.sys.date_format' is set to MM-dd-yy, the year value is not properly saved in the database.
If the year value is set between 00 an 38, the ShowXML shows the year to be 2000 - 2038.
If the year value is set to 39 or higher, the ShowXML shows the year to be 1939, 1940, etc.
Steps to Reproduce
- Set the system property 'glide.sys.date_format' to MM-dd-yy
- Run cache.do to clear the cache
- Open an incident form (incident.do)
- From the context menu, go to Configuration>Form Layout, create a new Date field and add it to the incident form.
- Create a new incident and set the date value to "11-20-38" and save the form
- Here the year value on the form is 38 and the expected value is 2038.
- Check this date value in Show XML and the year value is set properly as 2038.
- Update this date value and change it to 39.
- The expected value is 2039.
- Check this date value in Show XML and the year value is set to 1939, which is unexpected.
With the "yy" format, the default Java date time format uses an 80-20 metric - it assumes the date was either less than 80 years in the past and less than 20 years in the future (see SimpleDateFormat [Java 7 API] for more information).
In the previous example:
11-20-38 is within 20 years in the future, so the expected behavior is that it reads as 2038, which is it does.
11-20-39 is within 80 years in the past, so the expected behavior is that it reads as 1939, which it does.
This is expected behavior and by design in the current releases. The alternative is to use the YYYY format instead of YY.
Related Problem: PRB1350557