Date
Filter plugin : Date
- Author: InterestingLab
- Homepage: https://interestinglab.github.io/seatunnel-docs
- Version: 1.0.0
Description
The date filter is used for parsing dates from specified field.
Options
name | type | required | default value |
---|---|---|---|
default_value | string | no | ${now} |
locale | string | no | Locale.US |
source_field | string | no | __root__ |
source_time_format | string | no | UNIX_MS |
target_field | string | no | datetime |
target_time_format | string | no | yyyy/MM/dd HH:mm:ss |
time_zone | string | no | - |
default_value [string]
If the date conversion fails, the current time(${now}
) will be used in the specified format.
locale [string]
Locale of source field.
source_field [string]
Source field, if not configured, the current time will be used.
source_time_format [string]
Source field time format, currently supports UNIX(10-bit seconds timestamp), UNIX_MS(13-bit millisecond timestamp) and SimpleDateFormat
format. The commonly used time formats are listed below:
Symbol | Description |
---|---|
y | Year |
M | Month |
d | Day of month |
H | Hour in day (0-23) |
m | Minute in hour |
s | Second in minute |
The detailed time format syntax:Java SimpleDateFormat.
target_field [string]
Target field, default is datetime
.
target_time_format [string]
Target field time format, The detailed time format syntax:Java SimpleDateFormat.
time_zone [string]
Timezone of source field
Examples
date {
source_field = "timestamp"
target_field = "date"
source_time_format = "UNIX"
target_time_format = "yyyy/MM/dd"
}
Convert the
timestamp
field from UNIX timestamp to theyyyy/MM/dd
format.
date {
source_field = "httpdate"
target_field = "datetime"
source_time_format = "dd/MMM/yyyy:HH:mm:ss Z"
target_time_format = "yyyy/MM/dd HH:mm:ss"
}
Convert the
httpdate
field fromdd/MMM/yyyy:HH:mm:ss Z
format to theyyyy/MM/dd HH:mm:ss
format