Prerequisite
This article assumes you know how to use field formats to normalize and format your data in Parseur. Check out this article for more information.
Managing dates and times
Dates and times can take all kinds of shapes in your documents. Quite often, applications integrated with Parseur require date fields to be formatted in a specific way.
Parseur offers 3 types of date and time formats. They are rather self-explanatory.
Date format
The "Date" format will sanitize a field into a date.
If the field contains a date and a time, only the date information part will be kept.
Examples of dates recognized by Parseur:
12 Jan 2018
2018-1-2
Wed Jan 24th, 2018 1:58pm
01/12/2018: this date can either be the 12th of January or the 1st of December, depending on the locale and conventions. See the section below to tell Parseur how to disambiguate that situation.
Time format
The "Time" format will sanitize a field into a time.
If the field contains a date and a time, only the time information part will be kept.
Examples of times recognized by Parseur:
1:58 pm
13:58:23
12h36
Date and time format
The "Date and Time" format will sanitize a field into a datetime.
If the field contains no time information, 00:00:00 will be used for the time part.
Examples of datetimes recognized by Parseur:
Wed Jan 24th, 2018 1:58pm
12 Jan 2018 13:58:23
2018-01-24T05:18:44.841813+00:00
How do I configure the date input format?
Some dates can be ambiguous. For example, 04/06/2024 can mean either April 6th or June 4th, depending on whether you treat the date as mm/dd/yyyy or dd/mm/yyyy.
By default, Parseur will assume the month comes first. You can tell Parseur whether to treat ambiguous dates as month-first or day-first by updating the date input format.
You can change the date input format at account-level, mailbox-level, and template-level. Template-level settings override mailbox-level settings which override account-level settings.
Note: The "Day first" flag won't be observed for dates starting with the year, i.e. 2020-07-06
will always be treated as July 6th, 2020
, never as June 7th, 2020
.
How do I set the date input format at account level?
Open your account settings
Under the Input formats section, update date format in documents (either month first, or day first)
Optionally, update your timezone. Timezone is currently only used in date-related metadata fields and Getswift integration. The timezone here is used only if the timezone is not already present in the field.
Click on Save
How do I set the date input format at mailbox level?
Open your mailbox
Click on Settings
Scroll to the bottom of the General tab
Change your input format settings
Click on Save
How do I set the date input format at template level?
Open your template
Click on Settings
Change your input format settings
Click on Update
How do I configure the date output format?
Now that you've told Parseur that some fields are dates, you can specify the exact output format you would like those dates to be formatted in. The resulting fields are formatted according to your user preferences.
To change your result output preferences:
Open your account settings
Scroll down to the Output formats section
Change your result output preferences (see below the list of all available options)
Click on Update
List of available date formats
%a
: Weekday as locale’s abbreviated name. Example: Mon%A
: Weekday as locale’s full name. Example: Monday%w
: Weekday as a decimal number, where 0 is Sunday and 6 is Saturday. Example: 1%d
: Day of the month as a zero-padded decimal number. Example: 30%-d
: Day of the month as a decimal number. (Platform specific). Example: 30%b
: Month as locale’s abbreviated name. Example: Sep%B
: Month as locale’s full name. Example: September%m
: Month as a zero-padded decimal number. Example: 09%-m
: Month as a decimal number. (Platform specific). Example: 9%y
: Year without century as a zero-padded decimal number. Example: 13%Y
: Year with century as a decimal number. Example: 2013%H
: Hour (24-hour clock) as a zero-padded decimal number. Example: 07%-H
: Hour (24-hour clock) as a decimal number. (Platform specific). Example: 7%I
: Hour (12-hour clock) as a zero-padded decimal number. Example: 07%-I
: Hour (12-hour clock) as a decimal number. (Platform specific). Example: 7%p
: Locale’s equivalent of either AM or PM. Example: AM%M
: Minute as a zero-padded decimal number. Example: 06%-M
: Minute as a decimal number. (Platform specific). Example: 6%S
: Second as a zero-padded decimal number. Example: 05%-S
: Second as a decimal number. (Platform specific). Example: 5%f
: Microsecond as a decimal number, zero-padded on the left. Example: 000000%z
: UTC offset in the form +HHMM or -HHMM (empty string if the object is naive).%Z
: Time zone name (empty string if the object is naive).%j
: Day of the year as a zero-padded decimal number. Example: 273%-j
: Day of the year as a decimal number. (Platform specific). Example: 273%U
: Week number of the year (Sunday as the first day of the week) as a zero padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0. Example: 39%W
: Week number of the year (Monday as the first day of the week) as a decimal number. All days in a new year preceding the first Monday are considered to be in week 0. Example: 39%c
: Locale’s appropriate date and time representation. Example: Mon Sep 30 07:06:05 2013%x
: Locale’s appropriate date representation. Example: 09/30/13%X
: Locale’s appropriate time representation. Example: 07:06:05%%
: A literal '%' character. Example: %
Current Limitations when parsing dates
Parseur can only parse numeric dates and dates in English. We have an open feature request to add support for dates in other languages. Upvote that feature if you are interested in it, it will help us prioritize it.