Date Time Extractor

On this Page

Overview

The Date Time Extractor is a Transform type Snap that is used to extract components from datetime data and add them to the result field. You can use the Snap to prepare the data before performing aggregation or analysis. For example, to identify the total sales for each month or quarter. 

The Date Time Extractor Snap is an alternative to the Date class in the expression language.

Expected Input and Output

  • Expected input: A document with datetime fields.
  • Expected output: A document with fields that contain datetime components.
  • Expected upstream Snaps: Any Snap that has a document output stream. For example, Mapper, JSON Parser, etc.
  • Expected downstream Snaps: Any Snap that has a document input stream. For example, Aggregate, Profile, etc.

Prerequisite

The input document must contain datetime fields.

Configuring Accounts

Accounts are not used with this Snap.

Configuring Views

Input

This Snap has exactly one document input view.

OutputThis Snap has exactly one document output view.
ErrorThis Snap has at most one document error view.

Troubleshooting

None

Limitations and Known Issues

None

Modes


Snap Settings


LabelRequired. The name for the Snap. You can modify this to be specific, especially if you have more than one of the same Snap in your pipeline.
Policy

Specify your preferences for the date time extraction. Each policy contains an input field, component, and the result field. The Snap extracts the date or time component from the input field value and writes it to the result field.

Field

Required. Specifies the datetime field in the input document. This is a suggestible field that suggests all the fields in the incoming dataset. 

Ensure the field is in datetime type. To convert text to datetime, use the Type Converter Snap.

Default value: None

Component

Specifies the component that the Snap must extract from the input field. The available options are:

  • Date
  • Date String (yyyy-MM-dd)
  • Year
  • Quarter
  • Month
  • Day
  • Hour
  • Minute
  • Second
  • Millisecond
  • Year and Month (yyyy-MM)
  • Week of Year
  • Day of Year
  • Day of Week
  • Day of Week String (Sunday)
  • Month of Year String (January)
  • Epoch
  • Epoch Millisecond

Default value: Date

Result field

Required. The result field to be used in the output map. If the Result field is the same as Field, the values are overwritten. If the Result field does not exist in the original input document, a new field is added. 

Default value: None

Snap Execution

Select one of the three modes in which the Snap executes. Available options are:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.
  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.


Example

Simple Date Time Extraction

This pipeline demonstrates how we can extract date and time components from an input data using the Date Time Extractor Snap. 

  Download this pipeline.

 Understanding the pipeline

In this example, the Mapper Snap is used to generate a datetime object. The text 2013-02-01 is parsed into a datetime object using the Date.parse function in the Mapper Snap. The Mapper Snap configuration is as follows:

The datetime object generated by the Mapper Snap is as follows:

The datetime object from the Mapper Snap is passed to the Date Time Extractor Snap. The Date Time Extractor Snap is configured as follows:

The output preview of the Date Time Extractor Snap is as follows:

You can see that all the date time components from the input data are extracted.

Download this pipeline.

Snap Pack History

 Click to view/expand

4.27 (427patches13730)

  • Enhanced the Type Converter Snap with the Fail safe upon execution checkbox. Select this checkbox to enable the Snap to ignore invalid data types and convert data with valid data types.

4.27 (427patches13948)

4.27 (main12833)

  • No updates made.

4.26 (main11181)

  • No updates made.

4.25 (425patches10994)

  • Fixed an issue when the Deduplicate Snap where the Snap breaks when running on a locale that does not format decimals with Period (.) character. 

4.25 (main9554)

  • No updates made.

4.24 (main8556)

  • No updates made.

4.23 (main7430)

  • No updates made.

4.22 (main6403)

  • No updates made.

4.21 (snapsmrc542)

  • Introduces the Mask Snap that enables you to hide sensitive information in your dataset before exporting the dataset for analytics or writing the dataset to a target file.
  • Enhances the Match Snap to add a new field, Match all, which matches one record from the first input with multiple records in the second input. Also, enhances the Comparator field in the Snap by adding one more option, Exact, which identifies and classifies a match as either an exact match or not a match at all.
  • Enhances the Deduplicate Snap to add a new field, Group ID, which includes the Group ID for each record in the output. Also, enhances the Comparator field in the Snap by adding one more option, Exact, which identifies and classifies a match as either an exact match or not a match at all.
  • Enhances the Sample Snap by adding a second output view which displays data that is not in the first output. Also, a new algorithm type, Linear Split, which enables you to split the dataset based on the pass-through percentage.

4.20 Patch mldatapreparation8771

  • Removes the unused jcc-optional dependency from the ML Data Preparation Snap Pack.

4.20 (snapsmrc535)

  • No updates made.

4.19 (snapsmrc528)

  • New Snap: Introducing the Deduplicate Snap. Use this Snap to remove duplicate records from input documents. When you use multiple matching criteria to deduplicate your data, it is evaluated using each criterion separately, and then aggregated to give the final result.

4.18 (snapsmrc523)

  • No updates made.

4.17 Patch ALL7402

  • Pushed automatic rebuild of the latest version of each Snap Pack to SnapLogic UAT and Elastic servers.

4.17 (snapsmrc515)

  • New Snap: Introducing the Feature Synthesis Snap, which automatically creates features out of multiple datasets that share a one-to-one or one-to-many relationship with each other.
  • New Snap: Introducing the Match Snap, which enables you to automatically identify matched records across datasets that do not have a common key field.
  • Added the Snap Execution field to all Standard-mode Snaps. In some Snaps, this field replaces the existing Execute during preview check box.

4.16 (snapsmrc508)

  • Added a new Snap, Principal Component Analysis, which enables you to perform principal component analysis (PCA) on numeric fields (columns) to reduce dimensions of the dataset.

4.15 (snapsmrc500)

  • New Snap Pack. Perform preparatory operations on datasets such as data type transformation, data cleanup, sampling, shuffling, and scaling. Snaps in this Snap Pack are: 
    • Categorical to Numeric
    • Clean Missing Values
    • Date Time Extractor
    • Numeric to Categorical
    • Sample
    • Scale
    • Shuffle
    • Type Converter