Additional information about date and time patterns - Cloud

Talend Cloud Pipeline Designer Processors Guide

Version
Cloud
Language
English
Product
Talend Cloud
Module
Talend Pipeline Designer
Content
Design and Development > Designing Pipelines
Last publication date
2024-02-26

The Date processor allows you to apply operations on dates following specific date and time patterns.

Let's take the following input date and datetime format as an example: 7/22/2015 and 7/22/2015 6:33:01 (here this time is in AM).

What should be the date pattern set in the Date processor configuration?

Considering the following information:
  • M is used to describe months with one or two digits.

    Example: 7/22/2015 or 07/22/2015

  • MM is used to describe months with two digits.

    Example: 07/22/2015 is valid, but 7/22/2015 is not.

  • MMM is used to describe the abbreviated month names.

    Example: Jul

  • MMMM is used to describe full month names.

    Example: July

  • d is used to describe days with one or two digits.

    Example: 7/22/2015 or 7/2/2015

  • d is used to describe days with two digits.

    Example: 7/22/2015 is valid, but 07/2/2015 is not.

  • yyyy is used to describe the year.
    Note: The capital letter Y is used for week years.

    Example: 7/22/2015

  • H is used to describe hours in a day (0-23) with one or two digits. If you want to use hours in a day (1-24), use k.

    Example: 7/22/2015 6:33:01 or 07/22/2015 18:33:01

  • HH is used to describe hours in a day (0-23) with two digits.

    Example: 7/22/2015 18:33:01 is valid, but 07/22/2015 6:33:01 is not.

  • h is used to describe hours in AM/PM (1-12) with one or two digits. If you want to use hours in AM/PM (0-11), use K.

    Example: 7/22/2015 6:33:01 or 07/22/2015 06:33:01

  • hh is used to describe hours in AM/PM (1-12) with two digits.

    Example: 7/22/2015 06:33:01 is valid, but 07/22/2015 6:33:01 is not.

  • m is used to describe minutes with one or two digits.

    Example: 7/22/2015 6:3:01 or 7/22/2015 6:33:01

  • mm is used to describe minutes with two digits.

    Example: 7/22/2015 6:33:01 is valid, but 7/22/2015 6:3:01 is not.

  • s is used to describe seconds with one or two digits.

    Example: 7/22/2015 6:33:1 or 7/22/2015 6:33:01

  • ss is used to describe seconds with two digits.

    Example: 7/22/2015 6:33:01 is valid, but 7/22/2015 06:33:1 is not.

The date pattern for the 7/22/2015 date input should thus be set as one or two digits for the month, one or two digits for the day, and four digits for the year. The following patterns are valid:
  • M/d/yyyy
  • M/dd/yyyy
The datetime pattern for the 7/22/2015 6:33:01 (AM) datetime input should thus be set with one or two digits for the hours, one or two digits for the minutes, one or two digits for the seconds and AM digits for the time of the day. The following patterns are valid:
  • M/d/yyyy h:m:s
  • M/d/yyyy h:mm:s
  • M/d/yyyy h:mm:ss
  • M/d/yyyy h:m:ss

For more information on date and time formats, see the official Java documentation.