picop.cydatetime#

datetime.h helpers (imports DateTime C-API on load).

picop.cydatetime.dt_date_check(o)#

Return True if o is a date or subtype (PyDate_Check). :type o: object :param o:

Return type:

bool

picop.cydatetime.dt_date_check_exact(o)#

Return True if type(o) is date (PyDate_CheckExact). :type o: object :param o:

Return type:

bool

picop.cydatetime.dt_date_day(o)#

Return the day field of date o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_date_eq(a, b)#

Return True if a == b for dates (exact y/m/d; else richcompare). :type a: object :param a: :type b: object :param b:

Return type:

bool

picop.cydatetime.dt_date_month(o)#

Return the month field of date o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_date_new(year, month, day)#

Return a date via DateTime C-API.

Notes

Ranges are unchecked — trusted-caller. See Safety.

Parameters:
Return type:

object

picop.cydatetime.dt_date_year(o)#

Return the year field of date o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_datetime_check(o)#

Return True if o is a datetime or subtype (PyDateTime_Check). :type o: object :param o:

Return type:

bool

picop.cydatetime.dt_datetime_check_exact(o)#

Return True if type(o) is datetime (PyDateTime_CheckExact). :type o: object :param o:

Return type:

bool

picop.cydatetime.dt_datetime_day(o)#

Return the day field of datetime o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_datetime_eq(a, b)#

Return True if a == b for datetimes (exact naive fields; else richcompare). :type a: object :param a: :type b: object :param b:

Return type:

bool

picop.cydatetime.dt_datetime_hour(o)#

Return the hour field of datetime o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_datetime_microsecond(o)#

Return the microsecond field of datetime o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_datetime_minute(o)#

Return the minute field of datetime o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_datetime_month(o)#

Return the month field of datetime o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_datetime_new(year, month, day, hour, minute, second, microsecond, tz=None, fold=0)#

Return a datetime via DateTime C-API.

Notes

Ranges are unchecked — trusted-caller. See Safety.

Parameters:
Return type:

object

picop.cydatetime.dt_datetime_second(o)#

Return the second field of datetime o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_datetime_year(o)#

Return the year field of datetime o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_time_check(o)#

Return True if o is a time or subtype (PyTime_Check). :type o: object :param o:

Return type:

bool

picop.cydatetime.dt_time_check_exact(o)#

Return True if type(o) is time (PyTime_CheckExact). :type o: object :param o:

Return type:

bool

picop.cydatetime.dt_time_eq(a, b)#

Return True if a == b for times (exact naive h/m/s/us; else richcompare). :type a: object :param a: :type b: object :param b:

Return type:

bool

picop.cydatetime.dt_time_hour(o)#

Return the hour field of time o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_time_microsecond(o)#

Return the microsecond field of time o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_time_minute(o)#

Return the minute field of time o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_time_new(hour, minute, second, microsecond, tz=None, fold=0)#

Return a time via DateTime C-API.

Notes

Ranges are unchecked — trusted-caller. See Safety.

Parameters:
  • hour (int)

  • minute (int)

  • second (int)

  • microsecond (int)

  • tz (object, default: None)

  • fold (int, default: 0)

Return type:

object

picop.cydatetime.dt_time_second(o)#

Return the second field of time o. :type o: object :param o:

Return type:

int

picop.cydatetime.dt_timedelta_check(o)#

Return True if o is a timedelta or subtype.

Notes

Alias of dt_delta_check (preferred timedelta spelling).

Parameters:

o (object)

Return type:

bool

picop.cydatetime.dt_timedelta_check_exact(o)#

Return True if type(o) is timedelta.

Notes

Alias of dt_delta_check_exact (preferred timedelta spelling).

Parameters:

o (object)

Return type:

bool

picop.cydatetime.dt_timedelta_days(o)#

Return the days component of timedelta o.

Notes

Alias of dt_delta_days (preferred timedelta spelling).

Parameters:

o (object)

Return type:

int

picop.cydatetime.dt_timedelta_eq(a, b)#

Return True if a == b for timedeltas (exact days/s/us; else richcompare). :type a: object :param a: :type b: object :param b:

Return type:

bool

picop.cydatetime.dt_timedelta_microseconds(o)#

Return the microseconds component of timedelta o.

Notes

Alias of dt_delta_microseconds (preferred timedelta spelling).

Parameters:

o (object)

Return type:

int

picop.cydatetime.dt_timedelta_new(days, seconds, useconds)#

Return a timedelta via DateTime C-API. :type days: int :param days: :type seconds: int :param seconds: :type useconds: int :param useconds:

Return type:

object

picop.cydatetime.dt_timedelta_seconds(o)#

Return the seconds component of timedelta o.

Notes

Alias of dt_delta_seconds (preferred timedelta spelling).

Parameters:

o (object)

Return type:

int