Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

time

Subcommands

SubcommandDescriptionSyntax
nowReturns the current date and timenow()
strftimeFormats a timestamp into a stringstrftime(<expr>, <expr>)
strptimeAttempts to parse a string into a timestampstrptime(<expr>, <expr>)

Examples

now

| eval now=now()

strftime

Example to get the current year:

| eval year=strftime(now(), "%Y")

strptime

The parsing format must include timezone information:

| eval 
    time=strptime("1970-01-01T00:00:00Z", "%+")
    time2=strptime("1970-01-01T00:00:00+0000", "%Y-%m-%dT%H:%M:%S%z")