:right-sidebar: True Time =================================================================== .. currentmodule:: gi.repository.ICalGLib .. class:: Time(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.ICalGLib.Object`, :class:`~gi.repository.GObject.Object` This is the ICalTime instance. Constructors ------------ .. rst-class:: interim-class .. class:: Time :no-index: .. classmethod:: new() -> ~gi.repository.ICalGLib.Time Creates a new :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 .. classmethod:: new_current_with_zone(zone: ~gi.repository.ICalGLib.Timezone | None = None) -> ~gi.repository.ICalGLib.Time Creates a :obj:`~gi.repository.ICalGLib.Time` according to the timezone and current time. .. versionadded:: 1.0 :param zone: The timezone used to create a :obj:`~gi.repository.ICalGLib.Time` according to the current time .. classmethod:: new_from_day_of_year(day: int, year: int) -> ~gi.repository.ICalGLib.Time Creates a new time, given a day of year and a year. .. versionadded:: 1.0 :param day: The day of a year :param year: The year .. classmethod:: new_from_string(str: str) -> ~gi.repository.ICalGLib.Time Creates a time from an ISO format string. .. versionadded:: 1.0 :param str: The ISO format string .. classmethod:: new_from_timet_with_zone(v: int, is_date: int, zone: ~gi.repository.ICalGLib.Timezone | None = None) -> ~gi.repository.ICalGLib.Time Converts seconds past UNIX epoch to a timetype, using timezones. .. versionadded:: 1.0 :param v: The seconds past since epoch time :param is_date: Whether it is a date type, 1 if yes, 0 if not :param zone: The timezone, or :const:`None` .. classmethod:: new_null_date() -> ~gi.repository.ICalGLib.Time Creates a null date, which indicates no time has been set. .. versionadded:: 1.0 .. classmethod:: new_null_time() -> ~gi.repository.ICalGLib.Time Creates a default time which is an epoch time. .. versionadded:: 1.0 .. classmethod:: new_today() -> ~gi.repository.ICalGLib.Time Creates a :obj:`~gi.repository.ICalGLib.Time` representing today. .. versionadded:: 1.0 Methods ------- .. rst-class:: interim-class .. class:: Time :no-index: .. method:: add(d: ~gi.repository.ICalGLib.Duration) -> ~gi.repository.ICalGLib.Time Adds a time duration on the time. .. versionadded:: 2.0 :param d: A :obj:`~gi.repository.ICalGLib.Duration` as the difference .. method:: adjust(days: int, hours: int, minutes: int, seconds: int) -> None Adds or subtracts a number of days, hours, minutes and seconds from ``tt``\. .. versionadded:: 1.0 :param days: Difference of days adjusted :param hours: Difference of hours adjusted :param minutes: Difference of minutes adjusted :param seconds: Difference of seconds adjusted .. method:: as_ical_string() -> str Returns a string representation of the time, in RFC2445 format. .. versionadded:: 1.0 .. method:: as_timet() -> int Returns the time as seconds past the UNIX epoch. .. versionadded:: 1.0 .. method:: as_timet_with_zone(zone: ~gi.repository.ICalGLib.Timezone | None = None) -> int Returns the time as seconds past the UNIX epoch, using timezones. .. versionadded:: 1.0 :param zone: The timezone .. method:: clone() -> ~gi.repository.ICalGLib.Time Creates a new :obj:`~gi.repository.ICalGLib.Time`\, copy of ``timetype``\. .. versionadded:: 1.0 .. method:: compare(b: ~gi.repository.ICalGLib.Time) -> int i_cal_time_compare returns an integer indicating the result of the comparison, as follow: .. versionadded:: 1.0 :param b: The :obj:`~gi.repository.ICalGLib.Time` to be compared .. method:: compare_date_only(b: ~gi.repository.ICalGLib.Time) -> int Like :func:`~gi.repository.ICalGLib.Time.compare`, but only use the date parts. .. versionadded:: 1.0 :param b: The :obj:`~gi.repository.ICalGLib.Time` to be compared .. method:: compare_date_only_tz(b: ~gi.repository.ICalGLib.Time, zone: ~gi.repository.ICalGLib.Timezone | None = None) -> int Like i_cal_time_compare_tz(), but only use the date parts; accepts timezone. .. versionadded:: 1.0 :param b: The :obj:`~gi.repository.ICalGLib.Time` to be compared :param zone: The target timezone .. method:: convert_timezone(from_zone: ~gi.repository.ICalGLib.Timezone | None = None, to_zone: ~gi.repository.ICalGLib.Timezone | None = None) -> None Convert time from one timezone to another. .. versionadded:: 1.0 :param from_zone: From timezone :param to_zone: To timezone .. method:: convert_to_zone(zone: ~gi.repository.ICalGLib.Timezone | None = None) -> ~gi.repository.ICalGLib.Time Converts ``tt`` to ``zone`` and return new :obj:`~gi.repository.ICalGLib.Time` object. .. versionadded:: 1.0 :param zone: The target timezone .. method:: convert_to_zone_inplace(zone: ~gi.repository.ICalGLib.Timezone | None = None) -> None Converts ``tt`` to ``zone`` and store the result into ``tt``\. .. versionadded:: 3.0.5 :param zone: The target timezone .. method:: day_of_week() -> int Returns the day of the week of the given time. Sunday is 1. .. versionadded:: 1.0 .. method:: day_of_year() -> int Returns the day of the year of the given time. .. versionadded:: 1.0 .. classmethod:: days_in_month(year: int) -> int Gets the number of days in the target month in the target year. .. versionadded:: 1.0 :param year: The target year .. classmethod:: days_in_year() -> int Returns the number of days in this year. .. versionadded:: 2.0 .. classmethod:: days_is_leap_year() -> bool Checks whether a year is a leap year. .. versionadded:: 1.0 .. method:: get_date() -> tuple[int, int, int] Gets the year/month/date parts of the ``timetype`` in one call. .. versionadded:: 1.0 .. method:: get_day() -> int Gets the day of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 .. method:: get_hour() -> int Gets the hour of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 .. method:: get_minute() -> int Gets the minute of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 .. method:: get_month() -> int Gets the month of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 .. method:: get_second() -> int Gets the second of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 .. method:: get_time() -> tuple[int, int, int] Gets the hour/minute/second parts of the ``timetype`` in one call. .. versionadded:: 1.0 .. method:: get_timezone() -> ~gi.repository.ICalGLib.Timezone Returns the timezone, the :obj:`~gi.repository.ICalGLib.Timezone` object is cached and can be either unreferenced once the last instance is used or can be kept until :func:`~gi.repository.ICalGLib.Object.free_global_objects` is called (usually at the very end of the program). .. versionadded:: 1.0 .. method:: get_tzid() -> str | None Returns the tzid, or NULL for a floating time. .. versionadded:: 1.0 .. method:: get_year() -> int Gets the year of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 .. method:: is_date() -> bool Returns true if time is of DATE type, false if DATE-TIME. .. versionadded:: 1.0 .. method:: is_daylight() -> bool Gets the is_daylight of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 .. method:: is_null_time() -> bool Returns true if the time is null. .. versionadded:: 1.0 .. method:: is_utc() -> bool Returns true if time is relative to UTC zone. .. versionadded:: 1.0 .. method:: is_valid_time() -> bool Returns true if the time is null. .. versionadded:: 1.0 .. method:: normalize() -> ~gi.repository.ICalGLib.Time Normalizes the icaltime, so that all fields are within the normal range. .. versionadded:: 1.0 .. method:: normalize_inplace() -> None Normalizes the ``tt``\, so that all fields are within the normal range. .. versionadded:: 3.0.5 .. method:: set_date(year: int, month: int, day: int) -> None Sets the year/month/date parts of the ``timetype`` in one call. This doesn't verify validity of the given date. .. versionadded:: 1.0 :param year: The 'year' part of the date :param month: The 'month' part of the date :param day: The 'day' part of the date .. method:: set_day(day: int) -> None Sets the day of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 :param day: The day .. method:: set_hour(hour: int) -> None Sets the hour of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 :param hour: The hour .. method:: set_is_date(is_date: bool) -> None Sets the is_date of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 :param is_date: The is_date .. method:: set_is_daylight(is_daylight: bool) -> None Sets the is_daylight of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 :param is_daylight: The is_daylight .. method:: set_minute(minute: int) -> None Sets the minute of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 :param minute: The minute .. method:: set_month(month: int) -> None Sets the month of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 :param month: The month .. method:: set_second(second: int) -> None Sets the second of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 :param second: The second .. method:: set_time(hour: int, minute: int, second: int) -> None Sets the hour/minute/second parts of the ``timetype`` in one call. This doesn't verify validity of the given time. .. versionadded:: 1.0 :param hour: The 'hour' part of the time :param minute: The 'minute' part of the time :param second: The 'second' part of the time .. method:: set_timezone(zone: ~gi.repository.ICalGLib.Timezone | None = None) -> None Sets the timezone of the ``tt``\. .. versionadded:: 1.0 :param zone: The timezone .. method:: set_year(year: int) -> None Sets the year of :obj:`~gi.repository.ICalGLib.Time`\. .. versionadded:: 1.0 :param year: The year .. method:: start_doy_week(fdow: int) -> int Returns the day of the year for the first day of the week that the given time is within. .. versionadded:: 1.0 :param fdow: The first day of the week .. method:: subtract(t2: ~gi.repository.ICalGLib.Time) -> ~gi.repository.ICalGLib.Duration Gets the duration between two time. .. versionadded:: 2.0 :param t2: The subtracting :obj:`~gi.repository.ICalGLib.Time` .. classmethod:: timezone_expand_vtimezone(end_year: int, changes: ~gi.repository.ICalGLib.Array) -> None Applies a list of timezone changes on the array of components until the end year. .. versionadded:: 2.0 :param end_year: The end year :param changes: The changes to be applies .. method:: week_number() -> int Returns the week number for the week the given time is within. .. versionadded:: 1.0