MetaServer > Help > Extract > Format Date and Time

120-630 MetaServer Format – Format Date and Time

With MetaServer’s Format Date and Time rule, you can convert dates and time to different formats.

For example:
– A date can be written as “February 6, 2017”, “Feb 06, 17” or in numeric US formats like “2/6/2017”, “02-06-2017”, or in European formats like“6/02/2017” or “06-02-17”, etc.
– A time code could be written as “15:25:02”, “03:25 PM”, “152502”, etc.
– A full date consists of a date AND time code, like in “2018-06-18 15:25:02”

This rule can be useful for formatting your dates and time codes consistently and for filtering your text, so you only keep valid dates and time codes. It’s frequently combined with Replace Text, Find Word with Mask / Words or Find Line with Line Number rules.

In our example, we will make use of the “CB – INVOICES US” workflow. This workflow is automatically installed with CaptureBites MetaServer.

Format Date and Time rules are defined in a MetaServer Extract or Separate Document action.

To add this rule, press the Add button and select Format -> Date and Time

After extracting the Date and replacing all alphabetic months to numeric with a Replace Text rule, we want to format it in a consistent MM/DD/YYYY date format using the Format Date and Time rule.

First, add a description to your rule. Then, select a field that holds a date or time value. In this case, we select the field “Date”.

01 – Input format: enter the format that matches the input date and time. You can press the drop-down arrow to select different format types to compose your date and time format. In our case, we set up a MM(?)DD(?)YYYY date format. The (?) indicates any character, we use this as a separator because the Date’s separator can vary with each invoice.

02 – Output format: here you enter the format for the output date and time. You can press the drop-down arrow to select different format types to compose your date and time format. In our case, we will use a MM/DD/YYYY date output format.

03 – Example: here you can enter a date or time code to test the format. When you enter an invalid date in the example, the preview will show “Error”.

Notice that this format rule can also be used to convert single-digit days and months to double-digit months, and double-digit years to 4-digit years.

04 – Remove empty lines: this option removes any empty lines in your result. Disable this option if you are formatting line items and you need to keep empty records so that the number of line items re

TIP: you can copy the current settings and paste it in another setup window of the same type. Do this by pressing the Settings button in the bottom left of the Setup window and by selecting Copy. Then open another setup window of the same type and select Paste.

After:

  • Extracting words looking like a date with a Find Word with Mask / Words rule
  • Replacing all full name months with numeric months
  • Using a Format Date and Time rule to only keep valid dates and format them consistently
  • Using Find Line rules to only keep the first date on the document

we get the following result:

Before

After

Subscribe to our Newsletter


Please check the box below to agree to the privacy policy and continue *


NOTE: if you're experiencing trouble with submitting this form, please try again using another browser.