MetaTool > Help > Extraction > Format Date

060-770 MetaTool Format – Format Date

With the MetaTool Format Date rule, you can convert dates to different formats. For example, dates can be written as “February 6, 2017”, “Feb 06, 17”, “2/6/2017”, “02-06-2017”, “6/02/2017”, etc…

By using the Format Date rule, you can make the date format consistent.

01 Format Date – Add Rule

Format Date is defined in the MetaTool Extract tab.

Press the Add button and select Format – Date to add the format rule.

The Format Date Setup window opens.

02 Format Date – Setup

In our example we will make use of the CB MetaTool Keyword Doc Sep job. This job is automatically installed when you install CaptureBites MetaTool.

We will first add an Advanced OCR rule for the index field “Full Text Last Page” and find the Invoice Date from each document. Refer to the help pages of the Find Line with Mask / Words, and Find Word with Mask / Words for more details.

 

The result looks like this:

Finally, we will change the format of the Invoice Date from MM/DD/YYYY to MMDDYYYY. We select the index field “Invoice Date” that holds the date value we want to change.

Optionally, we enter a description.

03 – Source format: here you enter the format that matches the Source date, in our case it’s MM/DD/YYYY, the format of the extracted invoice date of the document. You can also press the Setup button to select different format types to compose your date format.
04 – Output format: here you enter the format of the output date. In our case it’s MMDDYYYY, without separators. You can also press the Setup button to select different format types to compose your output date format.
05 – Example: here you can enter a date to test the date format.
The final result will look like this:

Single-digit days and single-digit months will be converted to double digits with a leading zero, so the date is returned with a consistent length after formatting.
For example, 2/6/2017 will be converted to 02/06/2012.

Invalid dates like 32/6/2017 will not pass the formatting rule and return a blank value.

You can use the Format Date rule to find a valid date in a sequence of words.

Assume your index field contains 3 lines:
99/99/99
02/06/12
75/BA/15

If you format this multiline field with a Format Date rule, it will return 02/06/12, the only valid date in the sequence.