Timestamp difference(时间戳差值(Timestamp difference))¶
Supported in: Batch, Faster, Streaming
Returns the difference between two timestamps in the given time unit.
Expression categories: Datetime
Declared arguments¶
- End: The end date or time to subtract from.
Expression\ - Start: The start date or time to be subtracted.
Expression\ - Unit: Time unit.
Enum\
Output type: Long
Examples¶
Example 1: Base case¶
Argument values:
- End: 2022-10-01T10:00:00Z
- Start: 2022-10-01T09:00:00Z
- Unit:
HOURS
Output: 1
Example 2: Null case¶
Argument values:
- End:
End - Start:
Start - Unit:
HOURS
| Start | End | Output |
|---|---|---|
| null | 2020-01-01 | null |
| 2020-01-01 | null | null |
| null | null | null |
中文翻译¶
时间戳差值(Timestamp difference)¶
支持:批处理(Batch)、快速处理(Faster)、流处理(Streaming)
返回两个时间戳在指定时间单位下的差值。
表达式类别: 日期时间(Datetime)
声明的参数¶
- 结束时间(End): 被减的结束日期或时间。
表达式\ - 开始时间(Start): 要减去的开始日期或时间。
表达式\ - 单位(Unit): 时间单位。
枚举\
输出类型: Long
示例¶
示例 1:基础情况¶
参数值:
- 结束时间: 2022-10-01T10:00:00Z
- 开始时间: 2022-10-01T09:00:00Z
- 单位:
HOURS
输出: 1
示例 2:空值情况¶
参数值:
- 结束时间:
End - 开始时间:
Start - 单位:
HOURS
| Start | End | 输出 |
|---|---|---|
| null | 2020-01-01 | null |
| 2020-01-01 | null | null |
| null | null | null |