Skip to main content
Pixeltable UDFs for TimestampType. Usage example:
import pixeltable as pxt

t = pxt.get_table(...)
t.select(t.timestamp_col.year, t.timestamp_col.weekday()).collect()
View source on GitHub

udf astimezone()

astimezone(self: Timestamp, tz: String) -> Timestamp
Convert the datetime to the given time zone. Parameters:
  • tz (String): The time zone to convert to. Must be a valid time zone name from the IANA Time Zone Database.

udf day()

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

udf hour()

hour(self: Timestamp) -> Int
Between 0 and 23 inclusive. Equivalent to datetime.hour.

udf isocalendar()

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

udf isoformat()

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

udf isoweekday()

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

udf make_timestamp()

make_timestamp(
    year: Int,
    month: Int,
    day: Int,
    hour: Int = 0,
    minute: Int = 0,
    second: Int = 0,
    microsecond: Int = 0
) -> Timestamp
Create a timestamp. Equivalent to datetime().

udf microsecond()

microsecond(self: Timestamp) -> Int
Between 0 and 999999 inclusive. Equivalent to datetime.microsecond.

udf minute()

minute(self: Timestamp) -> Int
Between 0 and 59 inclusive. Equivalent to datetime.minute.

udf month()

month(self: Timestamp) -> Int
Between 1 and 12 inclusive. Equivalent to datetime.month.

udf posix_timestamp()

posix_timestamp(self: Timestamp) -> Float
Return POSIX timestamp corresponding to the datetime instance. Equivalent to datetime.timestamp().

udf replace()

replace(
    self: Timestamp,
    year: Int | None = None,
    month: Int | None = None,
    day: Int | None = None,
    hour: Int | None = None,
    minute: Int | None = None,
    second: Int | None = None,
    microsecond: Int | None = None
) -> Timestamp
Return a datetime with the same attributes, except for those attributes given new values by whichever keyword arguments are specified. Equivalent to datetime.replace().

udf second()

second(self: Timestamp) -> Int
Between 0 and 59 inclusive. Equivalent to datetime.second.

udf strftime()

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

udf toordinal()

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

udf weekday()

weekday(self: Timestamp) -> Int
Between 0 (Monday) and 6 (Sunday) inclusive. Equivalent to datetime.weekday().

udf year()

year(self: Timestamp) -> Int
Between MINYEAR and MAXYEAR inclusive. Equivalent to datetime.year.