DateTime#

class DateTime(**kwargs)#
Constructors:

new(tz:GLib.TimeZone, year:int, month:int, day:int, hour:int, minute:int, seconds:float) -> GLib.DateTime or None
new_from_iso8601(text:str, default_tz:GLib.TimeZone=None) -> GLib.DateTime or None
new_from_timeval_local(tv:GLib.TimeVal) -> GLib.DateTime or None
new_from_timeval_utc(tv:GLib.TimeVal) -> GLib.DateTime or None
new_from_unix_local(t:int) -> GLib.DateTime or None
new_from_unix_local_usec(usecs:int) -> GLib.DateTime or None
new_from_unix_utc(t:int) -> GLib.DateTime or None
new_from_unix_utc_usec(usecs:int) -> GLib.DateTime or None
new_local(year:int, month:int, day:int, hour:int, minute:int, seconds:float) -> GLib.DateTime or None
new_now(tz:GLib.TimeZone) -> GLib.DateTime or None
new_now_local() -> GLib.DateTime or None
new_now_utc() -> GLib.DateTime or None
new_utc(year:int, month:int, day:int, hour:int, minute:int, seconds:float) -> GLib.DateTime or None

Constructors#

class DateTime
classmethod new(tz: TimeZone, year: int, month: int, day: int, hour: int, minute: int, seconds: float) DateTime | None#
Parameters:
  • tz

  • year

  • month

  • day

  • hour

  • minute

  • seconds

classmethod new_from_iso8601(text: str, default_tz: TimeZone | None = None) DateTime | None#
Parameters:
  • text

  • default_tz

classmethod new_from_timeval_local(tv: TimeVal) DateTime | None#
Parameters:

tv

classmethod new_from_timeval_utc(tv: TimeVal) DateTime | None#
Parameters:

tv

classmethod new_from_unix_local(t: int) DateTime | None#
Parameters:

t

classmethod new_from_unix_local_usec(usecs: int) DateTime | None#
Parameters:

usecs

classmethod new_from_unix_utc(t: int) DateTime | None#
Parameters:

t

classmethod new_from_unix_utc_usec(usecs: int) DateTime | None#
Parameters:

usecs

classmethod new_local(year: int, month: int, day: int, hour: int, minute: int, seconds: float) DateTime | None#
Parameters:
  • year

  • month

  • day

  • hour

  • minute

  • seconds

classmethod new_now(tz: TimeZone) DateTime | None#
Parameters:

tz

classmethod new_now_local() DateTime | None#
classmethod new_now_utc() DateTime | None#
classmethod new_utc(year: int, month: int, day: int, hour: int, minute: int, seconds: float) DateTime | None#
Parameters:
  • year

  • month

  • day

  • hour

  • minute

  • seconds

Methods#

class DateTime
add(timespan: int) DateTime | None#
Parameters:

timespan

add_days(days: int) DateTime | None#
Parameters:

days

add_full(years: int, months: int, days: int, hours: int, minutes: int, seconds: float) DateTime | None#
Parameters:
  • years

  • months

  • days

  • hours

  • minutes

  • seconds

add_hours(hours: int) DateTime | None#
Parameters:

hours

add_minutes(minutes: int) DateTime | None#
Parameters:

minutes

add_months(months: int) DateTime | None#
Parameters:

months

add_seconds(seconds: float) DateTime | None#
Parameters:

seconds

add_weeks(weeks: int) DateTime | None#
Parameters:

weeks

add_years(years: int) DateTime | None#
Parameters:

years

compare(dt2: DateTime) int#
Parameters:

dt2

difference(begin: DateTime) int#
Parameters:

begin

equal(dt2: DateTime) bool#
Parameters:

dt2

format(format: str) str | None#
Parameters:

format

format_iso8601() str | None#
get_day_of_month() int#
get_day_of_week() int#
get_day_of_year() int#
get_hour() int#
get_microsecond() int#
get_minute() int#
get_month() int#
get_second() int#
get_seconds() float#
get_timezone() TimeZone#
get_timezone_abbreviation() str#
get_utc_offset() int#
get_week_numbering_year() int#
get_week_of_year() int#
get_year() int#
get_ymd() tuple[int, int, int]#
hash() int#
is_daylight_savings() bool#
to_local() DateTime | None#
to_timeval(tv: TimeVal) bool#
Parameters:

tv

to_timezone(tz: TimeZone) DateTime | None#
Parameters:

tz

to_unix() int#
to_unix_usec() int#
to_utc() DateTime | None#