Date functions

View as Markdown

Date functions evaluate, convert, and manipulate date and time values.

FunctionDescription
BusinessDaysCounts the weekdays between two dates, excluding Saturdays and Sundays.
ConvertTimezoneConverts date and time values to the specified time zone.
DateAddAdds a specified quantity of time to a date.
DateDiffCalculates the time difference between two dates.
DateFormatFormats a date value to text based on the format provided.
DateFromUnixConverts a Unix timestamp to a date value.
DateFromUnixMsConverts a Unix timestamp in milliseconds to a date value.
DateFromUnixUsConverts a Unix timestamp in microseconds to a date value.
DateLookbackReturns the value of a variable at a previous point in time (or lookback period) determined by a specified date and offset.
DatePartExtracts the specified date part from a date value.
DateParseParses a text value in a specified format and returns a datetime value (date data type) in ISO format.
DateTruncTruncates the date to the specified date part.
DayReturns the day of the month from a date value as a number.
DayOfYearReturns the day of the year from a date value as a number.
EndOfMonthReturns the last day of the month from a date value.
HourReturns the hour component from a date value as a number.
InDateRangeDetermines if a date falls within a specified date range and returns True or False.
InPriorDateRangeDetermines if a date falls within the date range of a prior period and returns True or False.
LastDayEvaluates a specified component in a date value and returns the last datetime value of that component in ISO format.
MakeDateEvaluates specified values representing year, month, and day units and returns a datetime value in ISO format.
MinuteReturns an integer representing the minute component in a specified datetime value.
MonthReturns an integer representing the month component in a specified datetime value.
MonthNameReturns the name of the month component from a specified datetime value.
NowReturns the current date and time using your organization’s account timezone.
QuarterReturns an integer representing the quarter component in a specified datetime value.
SecondReturns an integer representing the second component in a specified datetime value.
TodayReturns the current date using your organization’s account timezone.
WeekdayReturns an integer representing the day of the week in a specified datetime value.
WeekdayNameReturns the name of the day of the week in a specified datetime value.
YearReturns an integer representing the year component in a specified datetime value.