Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
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.
- 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
BoxedObject Date Source # | |
(~) AttrOpTag tag AttrSet => Constructible Date tag Source # | |
Methods
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>.
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 |
Converts date
to a TimeVal
.
Since: 2.24