Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this Page

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

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. 

Info

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. 

Info

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

Multiexcerpt include macro
nameSnap Execution
pageAnaplan Read


Multiexcerpt include macro
nameSnap_Execution_Introduced
pageAnaplan Read



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.

Expand
titleUnderstanding 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.

Additional Resources

  • Glossary

  • Getting started with SnapLogic


    Insert excerpt
    ML Data Preparation Snap Pack
    ML Data Preparation Snap Pack
    nopaneltrue