Soup.Date¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
day |
r/w |
day of the month, 1 to 31 |
|
hour |
r/w |
hour of the day, 0 to 23 |
|
minute |
r/w |
minute, 0 to 59 |
|
month |
r/w |
the month, 1 to 12 |
|
offset |
r/w |
offset from UTC |
|
second |
r/w |
second, 0 to 59 (or up to 61 in the case of leap seconds) |
|
utc |
r/w |
|
|
year |
r/w |
the year, 1 to 9999 |
Methods¶
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Soup.Date¶
A date and time. The date is assumed to be in the (proleptic) Gregorian calendar. The time is in UTC if utc is
True
. Otherwise, the time is a local time, and offset gives the offset from UTC in minutes (such that adding offset to the time would give the correct UTC time). If utc isFalse
and offset is 0, then theSoup.Date
represents a “floating” time with no associated timezone information.- classmethod new(year, month, day, hour, minute, second)¶
- Parameters:
- Returns:
a new
Soup.Date
- Return type:
Creates a
Soup.Date
representing the indicated time, UTC.
- classmethod new_from_now(offset_seconds)¶
-
Creates a
Soup.Date
representing a time offset_seconds after the current time (or before it, if offset_seconds is negative). If offset_seconds is 0, returns the current time.If offset_seconds would indicate a time not expressible as a
time_t
, the return value will be clamped into range.
- classmethod new_from_string(date_string)¶
- Parameters:
date_string (
str
) – the date in some plausible format- Returns:
a new
Soup.Date
, orNone
if date_string could not be parsed.- Return type:
Parses date_string and tries to extract a date from it. This recognizes all of the “HTTP-date” formats from RFC 2616, all ISO 8601 formats containing both a time and a date, RFC 2822 dates, and reasonable approximations thereof. (Eg, it is lenient about whitespace, leading “0”s, etc.)
- free()¶
Frees self.
New in version 2.24.
- get_offset()¶
- Returns:
self's offset from UTC. If
Soup.Date.get_utc
() returnsFalse
butSoup.Date.get_offset
() returns 0, that means the date is a “floating” time with no associated offset information.- Return type:
Gets self's offset from UTC.
New in version 2.32.
- is_past()¶
-
Determines if self is in the past.
New in version 2.24.
- to_string(format)¶
- Parameters:
format (
Soup.DateFormat
) – the format to generate the date in- Returns:
self as a string
- Return type:
Converts self to a string in the format described by format.
- to_time_t()¶
- Returns:
self as a
time_t
- Return type:
Converts self to a
time_t
, assumming it to be in UTC.If self is not representable as a
time_t
, it will be clamped into range. (In particular, some HTTP cookies have expiration dates after “Y2.038k” (2038-01-19T03:14:07Z).)
- to_timeval()¶
- Returns:
a
GLib.TimeVal
structure in which to store the converted time.- Return type:
time:
GLib.TimeVal
Converts self to a
GLib.TimeVal
.New in version 2.24.
Deprecated since version ???: Do not use
GLib.TimeVal
, as it’s not Y2038-safe.