FormatTime
Read the API documentation »
Filter FormatTime
Overview
This filter formats and converts date/time strings from one format to another. It requires the source and destination field names along with 2 format strings, the first one indicates how to parse the input field while the second how to format it.
The source time parsing can fail if the time value does not match the provided format. In this situation the filter clears the destination field, thus the user can filter out those results with a NotNull filter.
Most standard formats are supported out of the box and you can provide your own format string, see Go time layout.
Supported time format are:
ANSICformat: “Mon Jan _2 15:04:05 2006”UnixDateformat: “Mon Jan _2 15:04:05 MST 2006”RubyDateformat: “Mon Jan 02 15:04:05 -0700 2006”RFC822format: “02 Jan 06 15:04 MST”RFC822Zthat is RFC822 with numeric zone, format: “02 Jan 06 15:04 -0700”RFC850format: “Monday, 02-Jan-06 15:04:05 MST”RFC1123format: “Mon, 02 Jan 2006 15:04:05 MST”RFC1123Zthat is RFC1123 with numeric zone, format: “Mon, 02 Jan 2006 15:04:05 -0700”RFC3339format: “2006-01-02T15:04:05Z07:00”RFC3339Nanoformat: “2006-01-02T15:04:05.999999999Z07:00”unixunix epoch in secondsunixmsunix epoch in millisecondsunixnsunix epoch in nanoseconds
Configuration
Keys available in the [filter.config] section:
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| SrcField | string | "" | true | Field name of the input time |
| DstField | string | "" | true | Field name of the output time |
| SrcFormat | string | “UnixDate” | false | Format of the input time |
| DstFormat | string | “unixms” | false | Format of the output time |
Last modified December 12, 2022