Skip to content

date

pixeltable.functions.date

Pixeltable UDFs for DateType.

Usage example:

import pixeltable as pxt

t = pxt.get_table(...)
t.select(t.date_col.year, t.date_col.weekday()).collect()

add_days

add_days(self: Date, n: Int) -> Date

Add n days to the date.

Equivalent to date + timedelta(days=n).

day

day(self: Date) -> Int

Between 1 and the number of days in the given month of the given year.

Equivalent to date.day.

isocalendar

isocalendar(self: Date) -> Json

Return a dictionary with three entries: 'year', 'week', and 'weekday'.

Equivalent to date.isocalendar().

isoformat

isoformat(self: Date, sep: String = 'T', timespec: String = 'auto') -> String

Return a string representing the date and time in ISO 8601 format.

Equivalent to date.isoformat().

Parameters:

  • sep (String, default: 'T' ) –

    Separator between date and time.

  • timespec (String, default: 'auto' ) –

    The number of additional terms in the output. See the date.isoformat() documentation for more details.

isoweekday

isoweekday(self: Date) -> Int

Return the day of the week as an integer, where Monday is 1 and Sunday is 7.

Equivalent to date.isoweekday().

make_date

make_date(year: Int, month: Int, day: Int) -> Date

Create a date.

Equivalent to datetime().

month

month(self: Date) -> Int

Between 1 and 12 inclusive.

Equivalent to date.month.

strftime

strftime(self: Date, format: String) -> String

Return a string representing the date and time, controlled by an explicit format string.

Equivalent to date.strftime().

Parameters:

toordinal

toordinal(self: Date) -> Int

Return the proleptic Gregorian ordinal of the date, where January 1 of year 1 has ordinal 1.

Equivalent to date.toordinal().

weekday

weekday(self: Date) -> Int

Between 0 (Monday) and 6 (Sunday) inclusive.

Equivalent to date.weekday().

year

year(self: Date) -> Int

Between MINYEAR and MAXYEAR inclusive.

Equivalent to date.year.