VDF-GUIdance logo



  Visual DataFlex Logo
  

Shared knowledge leads to accumulated knowledge

        Printer Friendly Page


Date masking problems

by Wil van Antwerpen

Summary

There are some serious problems when using date masks in vdf.
No Files Available
Date Created: 03/11/2001
Date Updated: 03/11/2001
Author: Wil van Antwerpen
Company: Antwise Solutions


Dangers with using the date mask

Using a normal date mask on your date-fields will cause some very strange behaviour of your programs.

Most users of dataflex programs will do a lot of data-entry, this means that they will type pretty much, they know what they typed and as a result they will not always watch at the screen for the results.

This implies that if the program has some automatic conversion to correct dates it should not make any mistakes.
The table below will show what happens if the user enters ambiguous dates. The results of various date settings in the windows regional settings are shown.

OpenWiki Format Parsing Error, no content passed.

Userinput d-M-yy M-d-yy dd-mm-yyyy mm-dd-yyyy
2271999
22799
1121999
212199
2121999
771999
22-12-99
22-12-09
11-12-99
21-12-99
21-12-99
31-12-99
12-31-99
12-31-09
11-21-99
12-21-99
12-21-99
12-19-99
22-12-0999
22-12-2009
11-12-0999
21-12-1999
21-12-0999
31-12-1999
12-31-0999
12-31-2009
11-21-0999
12-21-1999
12-21-0999
12-19-1999

Notes:

  • With the two digit years in the regional settings a year-value of 0999 is displayed as "99" as long as the field doesn’t have the focus. This means that it will look to the user that he entered "1999" while in fact there is an error in his date of a 1000 years.
  • Users that are not stretching the date masks to its limits will not experience these problems "7-7-99" and "070799", or "7-7-1999" all are correct dates and will be correctly interpreted.

Solution

At the moment there is only one good way to protect your program against this danger:
Do not use date-masking at all. Without the extra masking DataFlex will correctly return an error to the user if he or she makes a mistake.
DataFlex itself is smart enough to handle the dates properly, it will even show the users a normal date mask.

Date Published: 03/11/2001