Skip to content

ybload Date Formats

This section describes the date formats supported by ybload operations. A ybload date format consists of two parts:

  • A date style, which describes how a date value is expressed. For example, YMD style means that a date value is expected to have year, month, and day pieces, in that order.
  • A date delimiter, which is the character that separates the date parts, such as a hyphen (-) or a backslash (/).

You can define acceptable date formats within --date-field-options, using the following syntax. In this example, MONDY2 is the date style and - is the delimiter:

"formats":[{"style":"MDY","delim":"-"}]

You can also define date formats within --per-field-options, when the field in question is being loaded into a DATE column.

As a shortcut, you can define date styles with the --date-style option, but you cannot set the delimiter with that option.

Supported Date Styles

The following table lists the legal date styles that you can use within --date-field-options, --per-field-options, and --date-style.

Date MaskExamples
YMD2016-08-13
DMY13-08-2016
MDY08/13/2016
MONDYAug 13 2016
DMONY13 Aug 2016
Y2MD16-08-13
DMY213-08-16
MDY208/13/16
MONDY2Aug 13 16
DMONY213 Aug 16

Note: If you do not specify date styles explicitly, the default styles that are accepted are YMD, DMONY, and MONDY.

Note the following requirements for defining date styles:

  • If you are using a date style with a two-digit year (Y2), you need to set the --y2base option.
  • The bulk load parser recognizes YMD, DMONY, and MONDY automatically, but the other styles need to be set explicitly.
  • The DMY and MDY date styles are ambiguous and cannot be specified together in one ybload command.

Supported Date Delimiters

The delim setting defines the delimiter between the day, month, and year parts of a date. You can use default supported delimiters within the date string or set a different delimiter.

The following delimiters are supported:

  • auto (the default), which means any one of the following: " ", ".", "-", "/", "|", ","
  • Empty string (""). Note that auto also allows the empty string ("") when style is set to YMD.
  • Any other explicitly specified character sequence. You may have fields to load that have special delimiter strings.

Examples

The following --date-field-options setting allows dates with two different date styles to be loaded from the same file:

--date-field-options '{"formats":[{"style":"YMD"},{"style":"MDY"}]}'

In this case, dates such as 2016-10-05 and 10-05-2016 can be loaded.

The following example extends the first by specifying that the delimiter for both date styles must be a tab character (\t):

--date-field-options '{"formats":[{"style":"YMD","delim":"\t"},{"style":"MDY","delim":"\t"}]}'

In this case, dates such as 2016 10 05 and 10 05 2016, where the white space represents a tab, can be loaded.

The following example sets the y2base year to 1968 and the date style to MDY2:

--date-field-options {"y2base":1968,"formats":["MDY2"]}

In this case, dates such as 10-11-10 are understood to refer to the year 2010.