跳转至

Timestamp add(时间戳加法(Timestamp add))

Supported in: Batch, Faster, Streaming

Add value to timestamp in specified unit.

Expression categories: Datetime

Declared arguments

  • Timestamp: no description
    Expression\
  • Unit: Time unit.
    Enum\
  • Value to add: no description
    Expression\

Output type: Timestamp

Examples

Example 1: Base case

Argument values:

  • Timestamp: 2022-02-01T00:00:00Z
  • Unit: DAYS
  • Value to add: 2

Output: 2022-02-03T00:00:00Z


Example 2: Base case

Argument values:

  • Timestamp: 2022-02-01T00:00:00Z
  • Unit: HOURS
  • Value to add: 2

Output: 2022-02-01T02:00:00Z


Example 3: Base case

Argument values:

  • Timestamp: 2022-02-01T00:00:00Z
  • Unit: MILLISECONDS
  • Value to add: 2

Output: 2022-02-01T00:00:00.002Z


Example 4: Base case

Argument values:

  • Timestamp: 2022-02-01T00:00:00Z
  • Unit: MINUTES
  • Value to add: 2

Output: 2022-02-01T00:02:00Z


Example 5: Base case

Argument values:

  • Timestamp: 2022-02-01T00:00:00Z
  • Unit: MONTHS
  • Value to add: 2

Output: 2022-04-01T00:00:00Z


Example 6: Base case

Argument values:

  • Timestamp: 2022-02-01T00:00:00Z
  • Unit: QUARTERS
  • Value to add: 2

Output: 2022-08-01T00:00:00Z


Example 7: Base case

Argument values:

  • Timestamp: 2022-02-01T00:00:00Z
  • Unit: SECONDS
  • Value to add: 2

Output: 2022-02-01T00:00:02Z


Example 8: Base case

Argument values:

  • Timestamp: 2022-02-01T00:00:00Z
  • Unit: YEARS
  • Value to add: 2

Output: 2024-02-01T00:00:00Z


Example 9: Null case

Argument values:

  • Timestamp: date
  • Unit: YEARS
  • Value to add: value
date value Output
2022-02-01T00:00:00Z null null
null 2 null
null null null


中文翻译


时间戳加法(Timestamp add)

支持:批处理(Batch)、快速处理(Faster)、流处理(Streaming)

按指定时间单位向时间戳添加数值。

表达式类别: 日期时间(Datetime)

声明的参数

  • 时间戳(Timestamp): 无描述
    表达式\
  • 单位(Unit): 时间单位。
    枚举\
  • 要添加的数值(Value to add): 无描述
    表达式\

输出类型: Timestamp

示例

示例 1:基础案例

参数值:

  • 时间戳: 2022-02-01T00:00:00Z
  • 单位: DAYS
  • 要添加的数值: 2

输出: 2022-02-03T00:00:00Z


示例 2:基础案例

参数值:

  • 时间戳: 2022-02-01T00:00:00Z
  • 单位: HOURS
  • 要添加的数值: 2

输出: 2022-02-01T02:00:00Z


示例 3:基础案例

参数值:

  • 时间戳: 2022-02-01T00:00:00Z
  • 单位: MILLISECONDS
  • 要添加的数值: 2

输出: 2022-02-01T00:00:00.002Z


示例 4:基础案例

参数值:

  • 时间戳: 2022-02-01T00:00:00Z
  • 单位: MINUTES
  • 要添加的数值: 2

输出: 2022-02-01T00:02:00Z


示例 5:基础案例

参数值:

  • 时间戳: 2022-02-01T00:00:00Z
  • 单位: MONTHS
  • 要添加的数值: 2

输出: 2022-04-01T00:00:00Z


示例 6:基础案例

参数值:

  • 时间戳: 2022-02-01T00:00:00Z
  • 单位: QUARTERS
  • 要添加的数值: 2

输出: 2022-08-01T00:00:00Z


示例 7:基础案例

参数值:

  • 时间戳: 2022-02-01T00:00:00Z
  • 单位: SECONDS
  • 要添加的数值: 2

输出: 2022-02-01T00:00:02Z


示例 8:基础案例

参数值:

  • 时间戳: 2022-02-01T00:00:00Z
  • 单位: YEARS
  • 要添加的数值: 2

输出: 2024-02-01T00:00:00Z


示例 9:空值案例

参数值:

  • 时间戳: date
  • 单位: YEARS
  • 要添加的数值: value
date value 输出
2022-02-01T00:00:00Z null null
null 2 null
null null null