timestamp
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()
astimezone
astimezone(self: datetime, tz: str) -> datetime
Convert the datetime to the given time zone.
Parameters:
-
tz
(str
) –The time zone to convert to. Must be a valid time zone name from the IANA Time Zone Database.
day
day(self: datetime) -> int
Between 1 and the number of days in the given month of the given year.
Equivalent to datetime.day
.
isocalendar
isocalendar(self: datetime) -> JsonT
Return a dictionary with three entries: 'year'
, 'week'
, and 'weekday'
.
Equivalent to
datetime.isocalendar()
.
isoformat
isoformat(self: datetime, sep: str = 'T', timespec: str = 'auto') -> str
Return a string representing the date and time in ISO 8601 format.
Equivalent to datetime.isoformat()
.
Parameters:
-
sep
(str
, default:'T'
) –Separator between date and time.
-
timespec
(str
, default:'auto'
) –The number of additional terms in the output. See the
datetime.isoformat()
documentation for more details.
isoweekday
isoweekday(self: datetime) -> int
Return the day of the week as an integer, where Monday is 1 and Sunday is 7.
Equivalent to datetime.isoweekday()
.
make_timestamp
make_timestamp(
year: int,
month: int,
day: int,
hour: int = 0,
minute: int = 0,
second: int = 0,
microsecond: int = 0,
) -> datetime
Create a timestamp.
Equivalent to datetime()
.
microsecond
microsecond(self: datetime) -> int
Between 0 and 999999 inclusive.
Equivalent to datetime.microsecond
.
posix_timestamp
posix_timestamp(self: datetime) -> float
Return POSIX timestamp corresponding to the datetime instance.
Equivalent to datetime.timestamp()
.
replace
replace(
self: datetime,
year: Optional[int] = None,
month: Optional[int] = None,
day: Optional[int] = None,
hour: Optional[int] = None,
minute: Optional[int] = None,
second: Optional[int] = None,
microsecond: Optional[int] = None,
) -> datetime
Return a datetime with the same attributes, except for those attributes given new values by whichever keyword arguments are specified.
Equivalent to datetime.replace()
.
strftime
strftime(self: datetime, format: str) -> str
Return a string representing the date and time, controlled by an explicit format string.
Equivalent to datetime.strftime()
.
Parameters:
-
format
(str
) –The format string to control the output. For a complete list of formatting directives, see
strftime()
andstrptime()
Behavior.
toordinal
toordinal(self: datetime) -> int
Return the proleptic Gregorian ordinal of the date, where January 1 of year 1 has ordinal 1.
Equivalent to datetime.toordinal()
.
weekday
weekday(self: datetime) -> int
Between 0 (Monday) and 6 (Sunday) inclusive.
Equivalent to datetime.weekday()
.
year
year(self: datetime) -> int
Between MINYEAR
and
MAXYEAR
inclusive.
Equivalent to datetime.year
.