Skip to main content
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()
View source on GitHub

UDFs


add_days() udf

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

day() udf

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

isocalendar() udf

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

isoformat() udf

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

isoweekday() udf

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

make_date() udf

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

month() udf

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

strftime() udf

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

toordinal() udf

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

weekday() udf

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

year() udf

Between MINYEAR and MAXYEAR inclusive. Equivalent to date.year. Signature:
year(self: Date)-> Int
I