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

UDFs


astimezone() udf

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

day() udf

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

hour() udf

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

isocalendar() udf

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

isoformat() udf

Return a string representing the date and time in ISO 8601 format. Equivalent to datetime.isoformat(). Signature:
isoformat(
    self: Timestamp,
    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 datetime.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 datetime.isoweekday(). Signature:
isoweekday(self: Timestamp)-> Int

make_timestamp() udf

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

microsecond() udf

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

minute() udf

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

month() udf

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

posix_timestamp() udf

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

replace() udf

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

second() udf

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

strftime() udf

Return a string representing the date and time, controlled by an explicit format string. Equivalent to datetime.strftime(). Signature:
strftime(
    self: Timestamp,
    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 datetime.toordinal(). Signature:
toordinal(self: Timestamp)-> Int

weekday() udf

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

year() udf

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