Formats a string according to strftime
, similar to unix
strftime
.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
as | string | true | Specifies the output field. | |
field | string | false | @timestamp | Where to get the current time. |
format | string | true | Format string. See Java documentation for valid Date/Time escapes. | |
locale | string | false | Specifies the locale such as US or en_GB . | |
timezone | string | false | Specifies the timezone such as GMT, EST or Europe/London. See the full list of supported timezones. |
Examples
Format time as 2021/11/26 06:54:45 using the
timestmp
field and UTC timezone
using assignment to fmttime
:
humio
time := formatTime("%Y/%m/%d %H:%M:%S", field=@timestamp, locale=en_US, timezone=Z)
Format time as Thursday 18 November 2021, 22:59 using US locale and PST
timezone using the as
parameter to
fmttime
humio
formattime("%A %d %B %Y, %R", as=fmttime, field=@timestamp, timezone=PST)