module pixeltable.functions.timestamp
Pixeltable UDFs forTimestampType.
Usage example:
udf add_seconds()
Signature
seconds to the timestamp.
The offset is elapsed time: 86400 seconds across a daylight saving time change move the wall-clock time by 23 or
25 hours. A timestamp without a time zone is in the default time zone. t.ts + timedelta(...) and
t.ts - timedelta(...) are shorthand for add_seconds().
seconds_since() returns the offset between two timestamps.
Parameters:
seconds(pxt.Float): The number of seconds to add. A negative number subtracts.
created_at:
udf astimezone()
Signature
tz(pxt.String): The time zone to convert to. Must be a valid time zone name from the IANA Time Zone Database.
udf day()
Signature
datetime.day.
udf hour()
Signature
datetime.hour.
udf isocalendar()
Signature
'year', 'week', and 'weekday'.
Equivalent to
datetime.isocalendar().
udf isoformat()
Signature
datetime.isoformat().
Parameters:
sep(pxt.String): Separator between date and time.timespec(pxt.String): The number of additional terms in the output. See thedatetime.isoformat()documentation for more details.
udf isoweekday()
Signature
datetime.isoweekday().
udf make_timestamp()
Signature
datetime().
udf microsecond()
Signature
datetime.microsecond.
udf minute()
Signature
datetime.minute.
udf month()
Signature
datetime.month.
udf now()
Signature
stored=False, evaluates it when the query runs. A stored computed column
records the time of the insert, and a recompute replaces it with the time of the recompute.
Equivalent to datetime.now(), with
the default time zone as tz.
Examples:
The tickets that are past due:
udf posix_timestamp()
Signature
datetime.timestamp().
udf replace()
Signature
datetime.replace().
udf second()
Signature
datetime.second.
udf seconds_since()
Signature
start to the timestamp.
The result is elapsed time, and it is negative if the timestamp is earlier than start. A timestamp without a
time zone is in the default time zone.
add_seconds() adds such an offset to a timestamp.
Parameters:
start(pxt.Timestamp): The start of the measured interval.
udf strftime()
Signature
datetime.strftime().
Parameters:
format(pxt.String): The format string to control the output. For a complete list of formatting directives, seestrftime()andstrptime()Behavior.
udf strip_timezone()
Signature
self and no tzinfo.
Equivalent to datetime.replace(tzinfo=None).
udf strptime()
Signature
datetime.strptime().
For an ISO 8601 string, astype(pxt.Timestamp) is enough.
Parameters:
date_string(pxt.String): The string to parse.format(pxt.String): The format of date_string. For a complete list of formatting directives, seestrftime()andstrptime()Behavior.
udf toordinal()
Signature
datetime.toordinal().
udf weekday()
Signature
datetime.weekday().
udf year()
Signature
MINYEAR and
MAXYEAR inclusive.
Equivalent to datetime.year.