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:58pm
  • 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 to configure date input format?

You can change your default date format preferences (in user preferences):

  1. Click on your name in the navigation bar in the top right corner
  2. Click on Settings on the left menu
  3. Click on the Default format tab
  4. In Input, change your result output preferences
  5. Under Timezone, select the time zone of your documents (most likely your time zone).
  6. Under Date format in documents, tell Parseur how ambiguous dates should be treated like (either month first, or day first)
  7. Click on Update

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 to configure 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:

  1. Click on your name in the navigation bar in the top right corner
  2. Click on Settings on the left menu
  3. Click on the Default formats tab
  4. In Output, change your result output preferences (see below the list of all available options)
  5. 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 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: %
Did this answer your question?