Date/time conversion: Using the fuzzy date/time parser

Ambiguous Date/Time Formats

Some date time formats can be ambiguous. For instance consider 07-Sep-06. That could mean the 7th of September 2006 or 6th September 2007.

It’s bad form that such formats exist in interchange formats, but they do. When you encounter such situations you can explicitly pass a format parameter to the D() function giving the expected format of the date/time value. For instance:

In this case we give a trivial example of passing in ‘yyyymmdd’.

Fortunately when you do get such formats you can leverage the sample data and annotations within the environment to quickly determine if you have made the correct assumptions.

The formatting parameters that the parser knows are covered next.

Leave A Comment?