Skip to main content

module  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()

udf  add_days()

Signature
add_days(self: pxt.Date, n: pxt.Int) -> pxt.Date
Add n days to the date. Equivalent to date + timedelta(days=n).

udf  day()

Signature
day(self: pxt.Date) -> pxt.Int
Between 1 and the number of days in the given month of the given year. Equivalent to date.day.

udf  isocalendar()

Signature
isocalendar(self: pxt.Date) -> pxt.Json
Return a dictionary with three entries: 'year', 'week', and 'weekday'. Equivalent to date.isocalendar().

udf  isoformat()

Signature
isoformat(
    self: pxt.Date,
    sep: pxt.String = 'T',
    timespec: pxt.String = 'auto'
) -> pxt.String
Return a string representing the date and time in ISO 8601 format. Equivalent to date.isoformat(). Parameters:
  • sep (pxt.String): Separator between date and time.
  • timespec (pxt.String): The number of additional terms in the output. See the date.isoformat() documentation for more details.

udf  isoweekday()

Signature
isoweekday(self: pxt.Date) -> pxt.Int
Return the day of the week as an integer, where Monday is 1 and Sunday is 7. Equivalent to date.isoweekday().

udf  make_date()

Signature
make_date(year: pxt.Int, month: pxt.Int, day: pxt.Int) -> pxt.Date
Create a date. Equivalent to datetime().

udf  month()

Signature
month(self: pxt.Date) -> pxt.Int
Between 1 and 12 inclusive. Equivalent to date.month.

udf  strftime()

Signature
strftime(self: pxt.Date, format: pxt.String) -> pxt.String
Return a string representing the date and time, controlled by an explicit format string. Equivalent to date.strftime(). Parameters:

udf  toordinal()

Signature
toordinal(self: pxt.Date) -> pxt.Int
Return the proleptic Gregorian ordinal of the date, where January 1 of year 1 has ordinal 1. Equivalent to date.toordinal().

udf  weekday()

Signature
weekday(self: pxt.Date) -> pxt.Int
Between 0 (Monday) and 6 (Sunday) inclusive. Equivalent to date.weekday().

udf  year()

Signature
year(self: pxt.Date) -> pxt.Int
Between 1 and 9999 inclusive. (Between MINYEAR and MAXYEAR as defined by the Python datetime library). Equivalent to date.year.