Documentation Index
Fetch the complete documentation index at: https://docs.pixeltable.com/llms.txt
Use this file to discover all available pages before exploring further.
module pixeltable.functions.timestamp
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()
udf astimezone()
@pxt.udf
astimezone(self: pxt.Timestamp, tz: pxt.String) -> pxt.Timestamp
Convert the datetime to the given time zone.
Parameters:
udf day()
@pxt.udf
day(self: pxt.Timestamp) -> pxt.Int
Between 1 and the number of days in the given month of the given year.
Equivalent to datetime.day.
udf hour()
@pxt.udf
hour(self: pxt.Timestamp) -> pxt.Int
Between 0 and 23 inclusive.
Equivalent to datetime.hour.
udf isocalendar()
@pxt.udf
isocalendar(self: pxt.Timestamp) -> pxt.Json
Return a dictionary with three entries: 'year', 'week', and 'weekday'.
Equivalent to
datetime.isocalendar().
@pxt.udf
isoformat(
self: pxt.Timestamp,
sep: pxt.String = 'T',
timespec: pxt.String = 'auto'
) -> pxt.String
Return a string representing the date and time in ISO 8601 format.
Equivalent to datetime.isoformat().
Parameters:
sep (pxt.String): Separator between date and time.
timespec (pxt.String): The number of additional terms in the output. See the
datetime.isoformat()
documentation for more details.
udf isoweekday()
@pxt.udf
isoweekday(self: pxt.Timestamp) -> pxt.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()
@pxt.udf
make_timestamp(
year: pxt.Int,
month: pxt.Int,
day: pxt.Int,
hour: pxt.Int = 0,
minute: pxt.Int = 0,
second: pxt.Int = 0,
microsecond: pxt.Int = 0
) -> pxt.Timestamp
Create a timestamp.
Equivalent to datetime().
udf microsecond()
@pxt.udf
microsecond(self: pxt.Timestamp) -> pxt.Int
Between 0 and 999999 inclusive.
Equivalent to datetime.microsecond.
udf minute()
@pxt.udf
minute(self: pxt.Timestamp) -> pxt.Int
Between 0 and 59 inclusive.
Equivalent to datetime.minute.
udf month()
@pxt.udf
month(self: pxt.Timestamp) -> pxt.Int
Between 1 and 12 inclusive.
Equivalent to datetime.month.
udf posix_timestamp()
@pxt.udf
posix_timestamp(self: pxt.Timestamp) -> pxt.Float
Return POSIX timestamp corresponding to the datetime instance.
Equivalent to datetime.timestamp().
udf replace()
@pxt.udf
replace(
self: pxt.Timestamp,
year: pxt.Int | None = None,
month: pxt.Int | None = None,
day: pxt.Int | None = None,
hour: pxt.Int | None = None,
minute: pxt.Int | None = None,
second: pxt.Int | None = None,
microsecond: pxt.Int | None = None
) -> pxt.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()
@pxt.udf
second(self: pxt.Timestamp) -> pxt.Int
Between 0 and 59 inclusive.
Equivalent to datetime.second.
udf strftime()
@pxt.udf
strftime(self: pxt.Timestamp, format: pxt.String) -> pxt.String
Return a string representing the date and time, controlled by an explicit format string.
Equivalent to datetime.strftime().
Parameters:
udf toordinal()
@pxt.udf
toordinal(self: pxt.Timestamp) -> pxt.Int
Return the proleptic Gregorian ordinal of the date, where January 1 of year 1 has ordinal 1.
Equivalent to datetime.toordinal().
udf weekday()
@pxt.udf
weekday(self: pxt.Timestamp) -> pxt.Int
Between 0 (Monday) and 6 (Sunday) inclusive.
Equivalent to datetime.weekday().
udf year()
@pxt.udf
year(self: pxt.Timestamp) -> pxt.Int
Between MINYEAR and
MAXYEAR inclusive.
Equivalent to datetime.year.