Date parsing in DataMasque
Often, rulesets need to specify a date format to convert text into a date. For example, using Date/Time masks, executing type casts or performing Conditional Masking.
Date parsing in DataMasque follows standard %-based directives, as documented in
strftime() and strptime() Format Codes.
An important point to note is how years with and without centuries are handled.
Parsing years with/without centuries (%Y vs. %y)
Two directives are available to parse years:
%Yto parse years with the century (e.g., 2020, 1999, 1867, etc.).%yto parse years without the century (e.g., 20, 99, 67, etc.).
When parsing years without a century using %y, the following interpretation applies:
- Years from 00 to 68 are interpreted as the years 2000 to 2068.
- Years from 69 to 99 are interpreted as the years 1969 to 1999.
While %y provides a convenient way to parse two-digit years,
it introduces ambiguity in interpretation,
especially near the transition between centuries.
It is recommended to use %Y whenever possible to avoid ambiguity,
and ensure consistent interpretation across platforms and environments.