On This Page

Home / Search/ Language Reference/ Functions/ Scalar Functions/DateTime Functions

DateTime Functions

A list of all DateTime functions supported by Cribl Search.


NameDescription
agoSubtracts the given timespan from the current UTC clock time.
datetime_addCalculates a new datetime from a specified datepart multiplied by a specified amount, added to a specified datetime.
datetime_diffCalculates the number of the specified periods between two datetime values.
datetime_partExtracts the requested date part as an integer value.
dayofmonthReturns the integer number representing the day number of the given month.
dayofweekReturns an integer between 0 and 6 representing the day of the week, beginning on Sunday.
dayofyearReturns the integer number representing the day number of the given year.
endofdayReturns the end of the day containing the date, shifted by an offset, if provided.
endofmonthReturns the end of the month containing the date, shifted by an offset, if provided.
endofweekReturns the end of the week containing the date, shifted by an offset, if provided.
endofyearReturns the end of the year containing the date, shifted by an offset, if provided.
format_datetimeFormats a datetime according to the provided format.
format_timespanFormats a timespan according to the provided format.
getmonth (monthofyear)Gets the month number (1–12) from a datetime.
getyear (yearofyear)Returns the year part of a datetime.
hourofdayReturns the integer number representing the hour number of the given date.
make_datetimeConverts the specified date and time into a datetime value (Unix time in seconds).
make_timespanConverts the specified time period into a datetime value (Unix time in seconds).
nowReturns the current UTC clock time as a datetime value (Unix time in seconds).
startofdayReturns the start of the day containing the date, shifted by an offset, if provided.
startofmonthReturns the start of the month containing the date, shifted by an offset, if provided.
startofweekReturns the start of the week containing the date, shifted by an offset, if provided.
startofyearReturns the start of the year containing the date, shifted by an offset, if provided.
strftime (format_time)Converts a datetime (date) object to a human-readable string.
strptime (parse_time)Converts a string to a datetime.
todatetimeConverts the input into a datetime value (Unix time in seconds).
totimespanConverts the input into a number of seconds.
unixtime_microseconds_todatetimeConverts the input into a datetime value (Unix time in seconds).
unixtime_milliseconds_todatetimeConverts the input into a datetime value (Unix time in seconds).
unixtime-nanoseconds_todatetimeConverts the input into a datetime value (Unix time in seconds).
unixtime_seconds_todatetimeConverts the input into a datetime value (Unix time in seconds).
week_of_yearReturns an integer representing the week number.