Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- 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.
Instances
Eq Date Source # | |
GBoxed Date Source # | |
Defined in GI.Soup.Structs.Date | |
ManagedPtrNewtype Date Source # | |
Defined in GI.Soup.Structs.Date toManagedPtr :: Date -> ManagedPtr Date | |
TypedObject Date Source # | |
Defined in GI.Soup.Structs.Date | |
HasParentTypes Date Source # | |
Defined in GI.Soup.Structs.Date | |
tag ~ 'AttrSet => Constructible Date tag Source # | |
IsGValue (Maybe Date) Source # | Convert |
Defined in GI.Soup.Structs.Date gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Date -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Date) | |
type ParentTypes Date Source # | |
Defined in GI.Soup.Structs.Date |
Methods
Click to display all available methods, including inherited ones
copy
free
getDay
:: (HasCallStack, MonadIO m) | |
=> Date |
|
-> m Int32 | Returns: |
Gets date
's day.
Since: 2.32
getHour
:: (HasCallStack, MonadIO m) | |
=> Date |
|
-> m Int32 | Returns: |
Gets date
's hour.
Since: 2.32
getMinute
:: (HasCallStack, MonadIO m) | |
=> Date |
|
-> m Int32 | Returns: |
Gets date
's minute.
Since: 2.32
getMonth
:: (HasCallStack, MonadIO m) | |
=> Date |
|
-> m Int32 | Returns: |
Gets date
's month.
Since: 2.32
getOffset
:: (HasCallStack, MonadIO m) | |
=> Date |
|
-> m Int32 | Returns: |
Gets date
's offset from UTC.
Since: 2.32
getSecond
:: (HasCallStack, MonadIO m) | |
=> Date |
|
-> m Int32 | Returns: |
Gets date
's second.
Since: 2.32
getUtc
Gets date
's UTC flag
Since: 2.32
getYear
:: (HasCallStack, MonadIO m) | |
=> Date |
|
-> m Int32 | Returns: |
Gets date
's year.
Since: 2.32
isPast
Determines if date
is in the past.
Since: 2.24
new
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> m Date | Returns: a new |
Creates a Date
representing the indicated time, UTC.
newFromNow
:: (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
:: (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
:: (HasCallStack, MonadIO m) | |
=> CLong |
|
-> m Date | Returns: a new |
Creates a Date
corresponding to when
toString
:: (HasCallStack, MonadIO m) | |
=> Date |
|
-> DateFormat |
|
-> m Text | Returns: |
Converts date
to a string in the format described by format
.
toTimeT
:: (HasCallStack, MonadIO m) | |
=> Date |
|
-> m CLong | Returns: |
Converts date
to a <type>time_t</type>, assumming it to be in
UTC.
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
:: (HasCallStack, MonadIO m) | |
=> Date |
|
-> m TimeVal |
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
set
date [ #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
set
date [ #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
set
date [ #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
set
date [ #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
set
date [ #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
set
date [ #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
set
date [ #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
set
date [ #year:=
value ]