Skip to Content

This page lists 51 functions in the spql.dt namespace generated from the default SPQL function catalog.

FunctionKindSummary
spql.dt.asfreqscalar functionValidate a period frequency conversion request.
spql.dt.ceilscalar functionCeil a temporal value to a fixed frequency.
spql.dt.current_datescalar functionReturn the current UTC date.
spql.dt.current_timescalar functionReturn the current UTC time of day.
spql.dt.current_timestampscalar functionReturn the current UTC timestamp.
spql.dt.dayscalar functionExtract the calendar day of month.
spql.dt.day_of_weekscalar functionExtract the zero-based weekday where Monday is 0.
spql.dt.day_of_yearscalar functionExtract the one-based day of year.
spql.dt.duration_componentsscalar functionSplit a duration into day-time components.
spql.dt.duration_totalscalar functionReturn a duration total in the requested unit.
spql.dt.floorscalar functionFloor a temporal value to a fixed frequency.
spql.dt.from_epochscalar functionConvert an epoch count into a timestamp.
spql.dt.hourscalar functionExtract the hour of day.
spql.dt.is_leap_yearscalar functionReturn whether the date belongs to a leap year.
spql.dt.is_month_endscalar functionReturn whether the date is the last day of its month.
spql.dt.is_month_startscalar functionReturn whether the date is the first day of its month.
spql.dt.is_quarter_endscalar functionReturn whether the date ends a quarter.
spql.dt.is_quarter_startscalar functionReturn whether the date starts a quarter.
spql.dt.is_year_endscalar functionReturn whether the date ends a year.
spql.dt.is_year_startscalar functionReturn whether the date starts a year.
spql.dt.iso_dayscalar functionExtract the ISO weekday where Monday is 1.
spql.dt.iso_weekscalar functionExtract the ISO week number.
spql.dt.iso_yearscalar functionExtract the ISO week-numbering year.
spql.dt.local_timescalar functionReturn the current local time of day.
spql.dt.local_timestampscalar functionReturn the current local timestamp.
spql.dt.minutescalar functionExtract the minute of hour.
spql.dt.monthscalar functionExtract the calendar month.
spql.dt.period_boundsscalar functionReturn half-open date bounds for a period string.
spql.dt.period_endscalar functionReturn the exclusive end date of a period.
spql.dt.period_startscalar functionReturn the inclusive start date of a period.
spql.dt.quarterscalar functionExtract the calendar quarter.
spql.dt.roundscalar functionRound a temporal value to a fixed frequency.
spql.dt.secondscalar functionExtract the second of minute.
spql.dt.strftimescalar functionFormat a temporal value with a strftime-like pattern.
spql.dt.to_datescalar functionParse a date string.
spql.dt.to_durationscalar functionParse a fixed elapsed duration.
spql.dt.to_epochscalar functionConvert a temporal value into an epoch count.
spql.dt.to_periodscalar functionParse a date string as a period label.
spql.dt.to_timescalar functionParse a time string.
spql.dt.to_timestampscalar functionParse a timestamp string.
spql.dt.truncscalar functionTruncate a temporal value to a named part.
spql.dt.tz_convertscalar functionConvert timestamp timezone metadata after validating the zone name.
spql.dt.tz_localizescalar functionAttach timezone metadata after validating the zone name.
spql.dt.yearscalar functionExtract the calendar year.
spql.dt.bdate_rangegenerator functionGenerate business dates over a bounded range.
spql.dt.date_rangegenerator functionGenerate date values over a bounded range.
spql.dt.generate_seriesgenerator functionGenerate a SQL-compatible timestamp series.
spql.dt.period_rangegenerator functionGenerate period labels over a bounded range.
spql.dt.time_rangegenerator functionGenerate time-of-day values within a bounded range.
spql.dt.timedelta_rangegenerator functionGenerate fixed elapsed durations over a bounded range.
spql.dt.timestamp_rangegenerator functionGenerate timestamp values over a bounded range.

spql.dt.asfreq

Kind: scalar function

Validate a period frequency conversion request.

Signature

spql.dt.asfreq(value, freq)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
freqyesNo parameter docs.

spql.dt.ceil

Kind: scalar function

Ceil a temporal value to a fixed frequency.

Signature

spql.dt.ceil(value, freq)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
freqyesNo parameter docs.

spql.dt.current_date

Kind: scalar function

Return the current UTC date.

Signature

spql.dt.current_date()

Parameters

No parameters.

spql.dt.current_time

Kind: scalar function

Return the current UTC time of day.

Signature

spql.dt.current_time()

Parameters

No parameters.

spql.dt.current_timestamp

Kind: scalar function

Return the current UTC timestamp.

Signature

spql.dt.current_timestamp()

Parameters

No parameters.

spql.dt.day

Kind: scalar function

Extract the calendar day of month.

Signature

spql.dt.day(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.day_of_week

Kind: scalar function

Extract the zero-based weekday where Monday is 0.

Signature

spql.dt.day_of_week(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.day_of_year

Kind: scalar function

Extract the one-based day of year.

Signature

spql.dt.day_of_year(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.duration_components

Kind: scalar function

Split a duration into day-time components.

Signature

spql.dt.duration_components(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.duration_total

Kind: scalar function

Return a duration total in the requested unit.

Signature

spql.dt.duration_total(value, unit)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
unityesNo parameter docs.

spql.dt.floor

Kind: scalar function

Floor a temporal value to a fixed frequency.

Signature

spql.dt.floor(value, freq)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
freqyesNo parameter docs.

spql.dt.from_epoch

Kind: scalar function

Convert an epoch count into a timestamp.

Signature

spql.dt.from_epoch(value, unit)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
unityesNo parameter docs.

spql.dt.hour

Kind: scalar function

Extract the hour of day.

Signature

spql.dt.hour(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.is_leap_year

Kind: scalar function

Return whether the date belongs to a leap year.

Signature

spql.dt.is_leap_year(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.is_month_end

Kind: scalar function

Return whether the date is the last day of its month.

Signature

spql.dt.is_month_end(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.is_month_start

Kind: scalar function

Return whether the date is the first day of its month.

Signature

spql.dt.is_month_start(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.is_quarter_end

Kind: scalar function

Return whether the date ends a quarter.

Signature

spql.dt.is_quarter_end(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.is_quarter_start

Kind: scalar function

Return whether the date starts a quarter.

Signature

spql.dt.is_quarter_start(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.is_year_end

Kind: scalar function

Return whether the date ends a year.

Signature

spql.dt.is_year_end(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.is_year_start

Kind: scalar function

Return whether the date starts a year.

Signature

spql.dt.is_year_start(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.iso_day

Kind: scalar function

Extract the ISO weekday where Monday is 1.

Signature

spql.dt.iso_day(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.iso_week

Kind: scalar function

Extract the ISO week number.

Signature

spql.dt.iso_week(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.iso_year

Kind: scalar function

Extract the ISO week-numbering year.

Signature

spql.dt.iso_year(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.local_time

Kind: scalar function

Return the current local time of day.

Signature

spql.dt.local_time()

Parameters

No parameters.

spql.dt.local_timestamp

Kind: scalar function

Return the current local timestamp.

Signature

spql.dt.local_timestamp()

Parameters

No parameters.

spql.dt.minute

Kind: scalar function

Extract the minute of hour.

Signature

spql.dt.minute(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.month

Kind: scalar function

Extract the calendar month.

Signature

spql.dt.month(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.period_bounds

Kind: scalar function

Return half-open date bounds for a period string.

Signature

spql.dt.period_bounds(value, freq)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
freqyesNo parameter docs.

spql.dt.period_end

Kind: scalar function

Return the exclusive end date of a period.

Signature

spql.dt.period_end(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.period_start

Kind: scalar function

Return the inclusive start date of a period.

Signature

spql.dt.period_start(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.quarter

Kind: scalar function

Extract the calendar quarter.

Signature

spql.dt.quarter(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.round

Kind: scalar function

Round a temporal value to a fixed frequency.

Signature

spql.dt.round(value, freq)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
freqyesNo parameter docs.

spql.dt.second

Kind: scalar function

Extract the second of minute.

Signature

spql.dt.second(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.strftime

Kind: scalar function

Format a temporal value with a strftime-like pattern.

Signature

spql.dt.strftime(value, format)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
formatyesNo parameter docs.

spql.dt.to_date

Kind: scalar function

Parse a date string.

Signature

spql.dt.to_date(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.to_duration

Kind: scalar function

Parse a fixed elapsed duration.

Signature

spql.dt.to_duration(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.to_epoch

Kind: scalar function

Convert a temporal value into an epoch count.

Signature

spql.dt.to_epoch(value, unit)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
unityesNo parameter docs.

spql.dt.to_period

Kind: scalar function

Parse a date string as a period label.

Signature

spql.dt.to_period(value, freq)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
freqyesNo parameter docs.

spql.dt.to_time

Kind: scalar function

Parse a time string.

Signature

spql.dt.to_time(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.to_timestamp

Kind: scalar function

Parse a timestamp string.

Signature

spql.dt.to_timestamp(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.trunc

Kind: scalar function

Truncate a temporal value to a named part.

Signature

spql.dt.trunc(value, part)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
partyesNo parameter docs.

spql.dt.tz_convert

Kind: scalar function

Convert timestamp timezone metadata after validating the zone name.

Signature

spql.dt.tz_convert(value, zone)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
zoneyesNo parameter docs.

spql.dt.tz_localize

Kind: scalar function

Attach timezone metadata after validating the zone name.

Signature

spql.dt.tz_localize(value, zone, ambiguous?, nonexistent?)

Parameters

NameRequiredDescription
valueyesNo parameter docs.
zoneyesNo parameter docs.
ambiguousnoNo parameter docs.
nonexistentnoNo parameter docs.

spql.dt.year

Kind: scalar function

Extract the calendar year.

Signature

spql.dt.year(value)

Parameters

NameRequiredDescription
valueyesNo parameter docs.

spql.dt.bdate_range

Kind: generator function

Generate business dates over a bounded range.

Signature

spql.dt.bdate_range(start, end, freq?, inclusive?, weekmask?, holidays?)

Parameters

NameRequiredDescription
startyesInclusive or exclusive start date.
endyesInclusive or exclusive end date.
freqnoBusiness-day frequency, default B.
inclusivenoboth, left, right, or neither; default both.
weekmasknoBusiness weekdays, default Mon Tue Wed Thu Fri.
holidaysnoComma-separated holiday dates to exclude.

Returns

A date value for each included business day.

spql.dt.date_range

Kind: generator function

This function has multiple public overloads.

spql.dt.date_range(start, end, freq, inclusive?)

Generate date values over a bounded range.

Parameters

NameRequiredDescription
startyesInclusive or exclusive range start.
endyesInclusive or exclusive range end.
freqyesFixed elapsed frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.date_range(start, end, periods, inclusive?)

Generate date values over a bounded range.

Parameters

NameRequiredDescription
startyesInclusive or exclusive range start.
endyesInclusive or exclusive range end.
periodsyesNumber of generated values.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.date_range(start, periods, freq, inclusive?)

Generate date values over a bounded range.

Parameters

NameRequiredDescription
startyesRange start.
periodsyesNumber of generated values.
freqyesFixed elapsed frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.date_range(end, periods, freq, inclusive?)

Generate date values over a bounded range.

Parameters

NameRequiredDescription
endyesRange end.
periodsyesNumber of generated values.
freqyesFixed elapsed frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.generate_series

Kind: generator function

Generate a SQL-compatible timestamp series.

Signature

spql.dt.generate_series(start, stop, step)

Parameters

NameRequiredDescription
startyesStart timestamp.
stopyesStop timestamp.
stepyesFixed elapsed step.

Returns

Timestamp values in [start, stop] using step.

spql.dt.period_range

Kind: generator function

This function has multiple public overloads.

spql.dt.period_range(start, end, freq, inclusive?)

Generate period labels over a bounded range.

Parameters

NameRequiredDescription
startyesInclusive or exclusive range start date.
endyesInclusive or exclusive range end date.
freqyesPeriod frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.period_range(start, end, periods, inclusive?, freq?)

Generate period labels over a bounded range.

Parameters

NameRequiredDescription
startyesInclusive or exclusive range start date.
endyesInclusive or exclusive range end date.
periodsyesNumber of generated values.
inclusivenoboth, left, right, or neither; default both.
freqnoPeriod frequency.

Returns

A single top-level value column.

spql.dt.period_range(start, periods, freq, inclusive?)

Generate period labels over a bounded range.

Parameters

NameRequiredDescription
startyesRange start date.
periodsyesNumber of generated values.
freqyesPeriod frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.period_range(end, periods, freq, inclusive?)

Generate period labels over a bounded range.

Parameters

NameRequiredDescription
endyesRange end date.
periodsyesNumber of generated values.
freqyesPeriod frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.time_range

Kind: generator function

This function has multiple public overloads.

spql.dt.time_range(start, end, freq, inclusive?)

Generate time-of-day values within a bounded range.

Parameters

NameRequiredDescription
startyesInclusive or exclusive range start.
endyesInclusive or exclusive range end.
freqyesFixed elapsed frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.time_range(start, end, periods, inclusive?)

Generate time-of-day values within a bounded range.

Parameters

NameRequiredDescription
startyesInclusive or exclusive range start.
endyesInclusive or exclusive range end.
periodsyesNumber of generated values.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.time_range(start, periods, freq, inclusive?)

Generate time-of-day values within a bounded range.

Parameters

NameRequiredDescription
startyesRange start.
periodsyesNumber of generated values.
freqyesFixed elapsed frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.time_range(end, periods, freq, inclusive?)

Generate time-of-day values within a bounded range.

Parameters

NameRequiredDescription
endyesRange end.
periodsyesNumber of generated values.
freqyesFixed elapsed frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.timedelta_range

Kind: generator function

This function has multiple public overloads.

spql.dt.timedelta_range(start, end, freq, inclusive?)

Generate fixed elapsed durations over a bounded range.

Parameters

NameRequiredDescription
startyesInclusive or exclusive range start.
endyesInclusive or exclusive range end.
freqyesFixed elapsed frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.timedelta_range(start, end, periods, inclusive?)

Generate fixed elapsed durations over a bounded range.

Parameters

NameRequiredDescription
startyesInclusive or exclusive range start.
endyesInclusive or exclusive range end.
periodsyesNumber of generated values.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.timedelta_range(start, periods, freq, inclusive?)

Generate fixed elapsed durations over a bounded range.

Parameters

NameRequiredDescription
startyesRange start.
periodsyesNumber of generated values.
freqyesFixed elapsed frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.timedelta_range(end, periods, freq, inclusive?)

Generate fixed elapsed durations over a bounded range.

Parameters

NameRequiredDescription
endyesRange end.
periodsyesNumber of generated values.
freqyesFixed elapsed frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.timestamp_range

Kind: generator function

This function has multiple public overloads.

spql.dt.timestamp_range(start, end, freq, inclusive?, tz?)

Generate timestamp values over a bounded range.

Parameters

NameRequiredDescription
startyesInclusive or exclusive range start.
endyesInclusive or exclusive range end.
freqyesFixed elapsed frequency.
inclusivenoboth, left, right, or neither; default both.
tznoOptional timezone metadata for timestamp ranges.

Returns

A single top-level value column.

spql.dt.timestamp_range(start, end, periods, inclusive?)

Generate timestamp values over a bounded range.

Parameters

NameRequiredDescription
startyesInclusive or exclusive range start.
endyesInclusive or exclusive range end.
periodsyesNumber of generated values.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.timestamp_range(start, periods, freq, inclusive?)

Generate timestamp values over a bounded range.

Parameters

NameRequiredDescription
startyesRange start.
periodsyesNumber of generated values.
freqyesFixed elapsed frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

spql.dt.timestamp_range(end, periods, freq, inclusive?)

Generate timestamp values over a bounded range.

Parameters

NameRequiredDescription
endyesRange end.
periodsyesNumber of generated values.
freqyesFixed elapsed frequency.
inclusivenoboth, left, right, or neither; default both.

Returns

A single top-level value column.

Last updated on