Soup.Date¶
Fields¶
| Name | Type | Access | Description | 
|---|---|---|---|
| day | int | r/w | day of the month, 1 to 31 | 
| hour | int | r/w | hour of the day, 0 to 23 | 
| minute | int | r/w | minute, 0 to 59 | 
| month | int | r/w | the month, 1 to 12 | 
| offset | int | r/w | offset from UTC | 
| second | int | r/w | second, 0 to 59 (or up to 61 in the case of leap seconds) | 
| utc | bool | r/w | Trueif the date is in UTC | 
| year | int | r/w | the year, 1 to 9999 | 
Methods¶
| class | new(year, month, day, hour, minute, second) | 
| class | new_from_now(offset_seconds) | 
| class | new_from_string(date_string) | 
| class | new_from_time_t(when) | 
| copy() | |
| free() | |
| get_day() | |
| get_hour() | |
| get_minute() | |
| get_month() | |
| get_offset() | |
| get_second() | |
| get_utc() | |
| get_year() | |
| is_past() | |
| to_string(format) | |
| to_time_t() | |
| to_timeval() | 
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 is- Falseand offset is 0, then the- Soup.Daterepresents 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.Daterepresenting the indicated time, UTC.
 - 
classmethod new_from_now(offset_seconds)¶
- Parameters: - offset_seconds ( - int) – offset from current time- Returns: - a new - Soup.Date- Return type: - Soup.Date- Creates a - Soup.Daterepresenting 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, or- Noneif date_string could not be parsed.- Return type: - Soup.Dateor- None- 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.) 
 - 
classmethod new_from_time_t(when)¶
- Parameters: - when ( - int) – a- time_t- Returns: - a new - Soup.Date- Return type: - Soup.Date- Creates a - Soup.Datecorresponding to when
 - 
free()¶
- Frees self. - New in version 2.24. 
 - 
get_offset()¶
- Returns: - self’s offset from UTC. If - Soup.Date.get_utc() returns- Falsebut- Soup.Date.get_offset() returns 0, that means the date is a “floating” time with no associated offset information.- Return type: - int- Gets self’s offset from UTC. - New in version 2.32. 
 - 
is_past()¶
- Returns: - Trueif self is in the past- Return type: - bool- 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: - str- Converts self to a string in the format described by format. 
 - 
to_time_t()¶
- Returns: - self as a - time_t- Return type: - int- 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.TimeValstructure 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.
 
- 
classmethod