| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Soup.Structs.Date
Contents
Description
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 False and offset is 0, then the
SoupDate represents a "floating" time with no associated timezone
information.
Synopsis
- newtype Date = Date (ManagedPtr Date)
- newZeroDate :: MonadIO m => m Date
- noDate :: Maybe Date
- dateCopy :: (HasCallStack, MonadIO m) => Date -> m Date
- dateFree :: (HasCallStack, MonadIO m) => Date -> m ()
- dateGetDay :: (HasCallStack, MonadIO m) => Date -> m Int32
- dateGetHour :: (HasCallStack, MonadIO m) => Date -> m Int32
- dateGetMinute :: (HasCallStack, MonadIO m) => Date -> m Int32
- dateGetMonth :: (HasCallStack, MonadIO m) => Date -> m Int32
- dateGetOffset :: (HasCallStack, MonadIO m) => Date -> m Int32
- dateGetSecond :: (HasCallStack, MonadIO m) => Date -> m Int32
- dateGetUtc :: (HasCallStack, MonadIO m) => Date -> m Int32
- dateGetYear :: (HasCallStack, MonadIO m) => Date -> m Int32
- dateIsPast :: (HasCallStack, MonadIO m) => Date -> m Bool
- dateNew :: (HasCallStack, MonadIO m) => Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> m Date
- dateNewFromNow :: (HasCallStack, MonadIO m) => Int32 -> m Date
- dateNewFromString :: (HasCallStack, MonadIO m) => Text -> m (Maybe Date)
- dateNewFromTimeT :: (HasCallStack, MonadIO m) => CLong -> m Date
- dateToString :: (HasCallStack, MonadIO m) => Date -> DateFormat -> m Text
- dateToTimeT :: (HasCallStack, MonadIO m) => Date -> m CLong
- dateToTimeval :: (HasCallStack, MonadIO m) => Date -> m TimeVal
- getDateDay :: MonadIO m => Date -> m Int32
- setDateDay :: MonadIO m => Date -> Int32 -> m ()
- getDateHour :: MonadIO m => Date -> m Int32
- setDateHour :: MonadIO m => Date -> Int32 -> m ()
- getDateMinute :: MonadIO m => Date -> m Int32
- setDateMinute :: MonadIO m => Date -> Int32 -> m ()
- getDateMonth :: MonadIO m => Date -> m Int32
- setDateMonth :: MonadIO m => Date -> Int32 -> m ()
- getDateOffset :: MonadIO m => Date -> m Int32
- setDateOffset :: MonadIO m => Date -> Int32 -> m ()
- getDateSecond :: MonadIO m => Date -> m Int32
- setDateSecond :: MonadIO m => Date -> Int32 -> m ()
- getDateUtc :: MonadIO m => Date -> m Bool
- setDateUtc :: MonadIO m => Date -> Bool -> m ()
- getDateYear :: MonadIO m => Date -> m Int32
- setDateYear :: MonadIO m => Date -> Int32 -> m ()
Exported types
Memory-managed wrapper type.
Constructors
| Date (ManagedPtr Date) |
Instances
| BoxedObject Date Source # | |
| tag ~ AttrSet => Constructible Date tag Source # | |
Defined in GI.Soup.Structs.Date | |
Methods
copy
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> m Date |
Copies date.
Since: 2.24
free
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> m () |
Frees date.
Since: 2.24
getDay
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> m Int32 | Returns: |
Gets date's day.
Since: 2.32
getHour
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> m Int32 | Returns: |
Gets date's hour.
Since: 2.32
getMinute
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> m Int32 | Returns: |
Gets date's minute.
Since: 2.32
getMonth
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> m Int32 | Returns: |
Gets date's month.
Since: 2.32
getOffset
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> m Int32 | Returns: |
Gets date's offset from UTC.
Since: 2.32
getSecond
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> m Int32 | Returns: |
Gets date's second.
Since: 2.32
getUtc
Gets date's UTC flag
Since: 2.32
getYear
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> m Int32 | Returns: |
Gets date's year.
Since: 2.32
isPast
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> m Bool | Returns: |
Determines if date is in the past.
Since: 2.24
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Int32 |
|
| -> Int32 |
|
| -> Int32 |
|
| -> Int32 |
|
| -> Int32 |
|
| -> Int32 |
|
| -> m Date | Returns: a new |
Creates a Date representing the indicated time, UTC.
newFromNow
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Int32 |
|
| -> m Date | Returns: a new |
Creates a Date representing a time offsetSeconds after the
current time (or before it, if offsetSeconds is negative). If
offset_seconds is 0, returns the current time.
If offsetSeconds would indicate a time not expressible as a
<type>time_t</type>, the return value will be clamped into range.
newFromString
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Text |
|
| -> m (Maybe Date) | Returns: a new |
Parses dateString 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.)
newFromTimeT
Arguments
| :: (HasCallStack, MonadIO m) | |
| => CLong |
|
| -> m Date | Returns: a new |
Creates a Date corresponding to when
toString
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> DateFormat |
|
| -> m Text | Returns: |
Converts date to a string in the format described by format.
toTimeT
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> m CLong | Returns: |
Converts date to a <type>time_t</type>.
If date is not representable as a <type>time_t</type>, it will be
clamped into range. (In particular, some HTTP cookies have
expiration dates after "Y2.038k" (2038-01-19T03:14:07Z).)
toTimeval
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Date |
|
| -> m TimeVal |
Converts date to a TimeVal.
Since: 2.24
Properties
day
day of the month, 1 to 31
getDateDay :: MonadIO m => Date -> m Int32 Source #
Get the value of the “day” field.
When overloading is enabled, this is equivalent to
get date #day
setDateDay :: MonadIO m => Date -> Int32 -> m () Source #
Set the value of the “day” field.
When overloading is enabled, this is equivalent to
setdate [ #day:=value ]
hour
hour of the day, 0 to 23
getDateHour :: MonadIO m => Date -> m Int32 Source #
Get the value of the “hour” field.
When overloading is enabled, this is equivalent to
get date #hour
setDateHour :: MonadIO m => Date -> Int32 -> m () Source #
Set the value of the “hour” field.
When overloading is enabled, this is equivalent to
setdate [ #hour:=value ]
minute
minute, 0 to 59
getDateMinute :: MonadIO m => Date -> m Int32 Source #
Get the value of the “minute” field.
When overloading is enabled, this is equivalent to
get date #minute
setDateMinute :: MonadIO m => Date -> Int32 -> m () Source #
Set the value of the “minute” field.
When overloading is enabled, this is equivalent to
setdate [ #minute:=value ]
month
the month, 1 to 12
getDateMonth :: MonadIO m => Date -> m Int32 Source #
Get the value of the “month” field.
When overloading is enabled, this is equivalent to
get date #month
setDateMonth :: MonadIO m => Date -> Int32 -> m () Source #
Set the value of the “month” field.
When overloading is enabled, this is equivalent to
setdate [ #month:=value ]
offset
offset from UTC
getDateOffset :: MonadIO m => Date -> m Int32 Source #
Get the value of the “offset” field.
When overloading is enabled, this is equivalent to
get date #offset
setDateOffset :: MonadIO m => Date -> Int32 -> m () Source #
Set the value of the “offset” field.
When overloading is enabled, this is equivalent to
setdate [ #offset:=value ]
second
second, 0 to 59 (or up to 61 in the case of leap seconds)
getDateSecond :: MonadIO m => Date -> m Int32 Source #
Get the value of the “second” field.
When overloading is enabled, this is equivalent to
get date #second
setDateSecond :: MonadIO m => Date -> Int32 -> m () Source #
Set the value of the “second” field.
When overloading is enabled, this is equivalent to
setdate [ #second:=value ]
utc
True if the date is in UTC
getDateUtc :: MonadIO m => Date -> m Bool Source #
Get the value of the “utc” field.
When overloading is enabled, this is equivalent to
get date #utc
setDateUtc :: MonadIO m => Date -> Bool -> m () Source #
Set the value of the “utc” field.
When overloading is enabled, this is equivalent to
setdate [ #utc:=value ]
year
the year, 1 to 9999
getDateYear :: MonadIO m => Date -> m Int32 Source #
Get the value of the “year” field.
When overloading is enabled, this is equivalent to
get date #year
setDateYear :: MonadIO m => Date -> Int32 -> m () Source #
Set the value of the “year” field.
When overloading is enabled, this is equivalent to
setdate [ #year:=value ]