Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
RIO.Time
Synopsis
- readsTime :: ParseTime t => TimeLocale -> String -> ReadS t
- readTime :: ParseTime t => TimeLocale -> String -> String -> t
- readSTime :: ParseTime t => Bool -> TimeLocale -> String -> ReadS t
- readPTime :: ParseTime t => Bool -> TimeLocale -> String -> ReadP t
- parseTimeOrError :: ParseTime t => Bool -> TimeLocale -> String -> String -> t
- parseTimeM :: (MonadFail m, ParseTime t) => Bool -> TimeLocale -> String -> String -> m t
- parseTime :: ParseTime t => TimeLocale -> String -> String -> Maybe t
- data ZonedTime = ZonedTime {}
- zonedTimeToUTC :: ZonedTime -> UTCTime
- utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime
- class FormatTime t
- formatTime :: FormatTime t => TimeLocale -> String -> t -> String
- class ParseTime t
- data TimeLocale = TimeLocale {}
- rfc822DateFormat :: String
- iso8601DateFormat :: Maybe String -> String
- defaultTimeLocale :: TimeLocale
- data LocalTime = LocalTime {}
- utcToLocalTime :: TimeZone -> UTCTime -> LocalTime
- ut1ToLocalTime :: Rational -> UniversalTime -> LocalTime
- localTimeToUTC :: TimeZone -> LocalTime -> UTCTime
- localTimeToUT1 :: Rational -> LocalTime -> UniversalTime
- diffLocalTime :: LocalTime -> LocalTime -> NominalDiffTime
- addLocalTime :: NominalDiffTime -> LocalTime -> LocalTime
- data TimeOfDay = TimeOfDay {}
- utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)
- timeToTimeOfDay :: DiffTime -> TimeOfDay
- timeToDaysAndTimeOfDay :: NominalDiffTime -> (Integer, TimeOfDay)
- timeOfDayToTime :: TimeOfDay -> DiffTime
- timeOfDayToDayFraction :: TimeOfDay -> Rational
- midnight :: TimeOfDay
- midday :: TimeOfDay
- makeTimeOfDayValid :: Int -> Int -> Pico -> Maybe TimeOfDay
- localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)
- daysAndTimeOfDayToTime :: Integer -> TimeOfDay -> NominalDiffTime
- dayFractionToTimeOfDay :: Rational -> TimeOfDay
- data TimeZone = TimeZone {}
- utc :: TimeZone
- timeZoneOffsetString' :: Maybe Char -> TimeZone -> String
- timeZoneOffsetString :: TimeZone -> String
- minutesToTimeZone :: Int -> TimeZone
- hoursToTimeZone :: Int -> TimeZone
- data CalendarDiffTime = CalendarDiffTime {}
- scaleCalendarDiffTime :: Integer -> CalendarDiffTime -> CalendarDiffTime
- calendarTimeTime :: NominalDiffTime -> CalendarDiffTime
- calendarTimeDays :: CalendarDiffDays -> CalendarDiffTime
- diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime
- addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime
- newtype UniversalTime = ModJulianDate {}
- data UTCTime = UTCTime {
- utctDay :: Day
- utctDayTime :: DiffTime
- getTime_resolution :: DiffTime
- data NominalDiffTime
- secondsToNominalDiffTime :: Pico -> NominalDiffTime
- nominalDiffTimeToSeconds :: NominalDiffTime -> Pico
- nominalDay :: NominalDiffTime
- data DiffTime
- secondsToDiffTime :: Integer -> DiffTime
- picosecondsToDiffTime :: Integer -> DiffTime
- diffTimeToPicoseconds :: DiffTime -> Integer
- data DayOfWeek
- dayOfWeek :: Day -> DayOfWeek
- toGregorian :: Day -> (Integer, Int, Int)
- showGregorian :: Day -> String
- gregorianMonthLength :: Integer -> Int -> Int
- fromGregorianValid :: Integer -> Int -> Int -> Maybe Day
- fromGregorian :: Integer -> Int -> Int -> Day
- diffGregorianDurationRollOver :: Day -> Day -> CalendarDiffDays
- diffGregorianDurationClip :: Day -> Day -> CalendarDiffDays
- addGregorianYearsRollOver :: Integer -> Day -> Day
- addGregorianYearsClip :: Integer -> Day -> Day
- addGregorianMonthsRollOver :: Integer -> Day -> Day
- addGregorianMonthsClip :: Integer -> Day -> Day
- addGregorianDurationRollOver :: CalendarDiffDays -> Day -> Day
- addGregorianDurationClip :: CalendarDiffDays -> Day -> Day
- isLeapYear :: Integer -> Bool
- newtype Day = ModifiedJulianDay {}
- diffDays :: Day -> Day -> Integer
- addDays :: Integer -> Day -> Day
- data CalendarDiffDays = CalendarDiffDays {}
- scaleCalendarDiffDays :: Integer -> CalendarDiffDays -> CalendarDiffDays
- calendarYear :: CalendarDiffDays
- calendarWeek :: CalendarDiffDays
- calendarMonth :: CalendarDiffDays
- calendarDay :: CalendarDiffDays
- getCurrentTime :: MonadIO m => m UTCTime
- getTimeZone :: MonadIO m => UTCTime -> m TimeZone
- getCurrentTimeZone :: MonadIO m => m TimeZone
- getZonedTime :: MonadIO m => m ZonedTime
- utcToLocalZonedTime :: MonadIO m => UTCTime -> m ZonedTime
Documentation
Arguments
:: ParseTime t | |
=> TimeLocale | Time locale. |
-> String | Format string. |
-> String | Input string. |
-> t | The time value. |
Arguments
:: ParseTime t | |
=> Bool | Accept leading whitespace? |
-> TimeLocale | Time locale. |
-> String | Format string |
-> ReadS t |
Parse a time value given a format string. See parseTimeM
for details.
Arguments
:: ParseTime t | |
=> Bool | Accept leading whitespace? |
-> TimeLocale | Time locale. |
-> String | Format string |
-> ReadP t |
Parse a time value given a format string. See parseTimeM
for details.
Arguments
:: ParseTime t | |
=> Bool | Accept leading and trailing whitespace? |
-> TimeLocale | Time locale. |
-> String | Format string. |
-> String | Input string. |
-> t | The time value. |
Parse a time value given a format string. Fails if the input could
not be parsed using the given format. See parseTimeM
for details.
Arguments
:: (MonadFail m, ParseTime t) | |
=> Bool | Accept leading and trailing whitespace? |
-> TimeLocale | Time locale. |
-> String | Format string. |
-> String | Input string. |
-> m t | Return the time value, or fail if the input could not be parsed using the given format. |
Parses a time value given a format string.
Supports the same %-codes as formatTime
, including %-
, %_
and %0
modifiers, however padding widths are not supported.
Case is not significant in the input string.
Some variations in the input are accepted:
%z
- accepts any of
±HHMM
or±HH:MM
. %Z
- accepts any string of letters, or any of the formats accepted by
%z
. %0Y
- accepts exactly four digits.
%0G
- accepts exactly four digits.
%0C
- accepts exactly two digits.
%0f
- accepts exactly two digits.
For example, to parse a date in YYYY-MM-DD format, while allowing the month
and date to have optional leading zeros (notice the -
modifier used for %m
and %d
):
Prelude Data.Time> parseTimeM True defaultTimeLocale "%Y-%-m-%-d" "2010-3-04" :: Maybe Day Just 2010-03-04
A local time together with a time zone.
There is no Eq
instance for ZonedTime
.
If you want to compare local times, use zonedTimeToLocalTime
.
If you want to compare absolute times, use zonedTimeToUTC
.
Constructors
ZonedTime | |
Fields |
Instances
Data ZonedTime | |
Defined in Data.Time.LocalTime.Internal.ZonedTime Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ZonedTime -> c ZonedTime Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ZonedTime Source # toConstr :: ZonedTime -> Constr Source # dataTypeOf :: ZonedTime -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ZonedTime) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ZonedTime) Source # gmapT :: (forall b. Data b => b -> b) -> ZonedTime -> ZonedTime Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ZonedTime -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ZonedTime -> r Source # gmapQ :: (forall d. Data d => d -> u) -> ZonedTime -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> ZonedTime -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ZonedTime -> m ZonedTime Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ZonedTime -> m ZonedTime Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ZonedTime -> m ZonedTime Source # | |
Show ZonedTime | |
NFData ZonedTime | |
Defined in Data.Time.LocalTime.Internal.ZonedTime |
zonedTimeToUTC :: ZonedTime -> UTCTime Source #
class FormatTime t Source #
Minimal complete definition
formatTime :: FormatTime t => TimeLocale -> String -> t -> String Source #
Substitute various time-related information for each %-code in the string, as per formatCharacter
.
The general form is %<modifier><width><alternate><specifier>
, where <modifier>
, <width>
, and <alternate>
are optional.
<modifier>
glibc-style modifiers can be used before the specifier (here marked as z
):
%-z
- no padding
%_z
- pad with spaces
%0z
- pad with zeros
%^z
- convert to upper case
%#z
- convert to lower case (consistently, unlike glibc)
<width>
Width digits can also be used after any modifiers and before the specifier (here marked as z
), for example:
%4z
- pad to 4 characters (with default padding character)
%_12z
- pad with spaces to 12 characters
<alternate>
An optional E
character indicates an alternate formatting. Currently this only affects %Z
and %z
.
%Ez
- alternate formatting
<specifier>
For all types (note these three are done by formatTime
, not by formatCharacter
):
%%
%
%t
- tab
%n
- newline
TimeZone
For TimeZone
(and ZonedTime
and UTCTime
):
%z
- timezone offset in the format
±HHMM
%Ez
- timezone offset in the format
±HH:MM
%Z
- timezone name (or else offset in the format
±HHMM
) %EZ
- timezone name (or else offset in the format
±HH:MM
)
LocalTime
For LocalTime
(and ZonedTime
and UTCTime
and UniversalTime
):
%c
- as
dateTimeFmt
locale
(e.g.%a %b %e %H:%M:%S %Z %Y
)
TimeOfDay
For TimeOfDay
(and LocalTime
and ZonedTime
and UTCTime
and UniversalTime
):
%R
- same as
%H:%M
%T
- same as
%H:%M:%S
%X
- as
timeFmt
locale
(e.g.%H:%M:%S
) %r
- as
time12Fmt
locale
(e.g.%I:%M:%S %p
) %P
- day-half of day from (
amPm
locale
), converted to lowercase,am
,pm
%p
- day-half of day from (
amPm
locale
),AM
,PM
%H
- hour of day (24-hour), 0-padded to two chars,
00
-23
%k
- hour of day (24-hour), space-padded to two chars,
0
-23
%I
- hour of day-half (12-hour), 0-padded to two chars,
01
-12
%l
- hour of day-half (12-hour), space-padded to two chars,
1
-12
%M
- minute of hour, 0-padded to two chars,
00
-59
%S
- second of minute (without decimal part), 0-padded to two chars,
00
-60
%q
- picosecond of second, 0-padded to twelve chars,
000000000000
-999999999999
. %Q
- decimal point and fraction of second, up to 12 second decimals, without trailing zeros.
For a whole number of seconds,
%Q
omits the decimal point unless padding is specified.
UTCTime
and ZonedTime
For UTCTime
and ZonedTime
:
%s
- number of whole seconds since the Unix epoch. For times before
the Unix epoch, this is a negative number. Note that in
%s.%q
and%s%Q
the decimals are positive, not negative. For example, 0.9 seconds before the Unix epoch is formatted as-1.1
with%s%Q
.
DayOfWeek
For DayOfWeek
(and Day
and LocalTime
and ZonedTime
and UTCTime
and UniversalTime
):
%u
- day of week number for Week Date format,
1
(= Monday) -7
(= Sunday) %w
- day of week number,
0
(= Sunday) -6
(= Saturday) %a
- day of week, short form (
snd
fromwDays
locale
),Sun
-Sat
%A
- day of week, long form (
fst
fromwDays
locale
),Sunday
-Saturday
Day
For Day
(and LocalTime
and ZonedTime
and UTCTime
and UniversalTime
):
%D
- same as
%m/%d/%y
%F
- same as
%Y-%m-%d
%x
- as
dateFmt
locale
(e.g.%m/%d/%y
) %Y
- year, no padding. Note
%0Y
and%_Y
pad to four chars %y
- year of century, 0-padded to two chars,
00
-99
%C
- century, no padding. Note
%0C
and%_C
pad to two chars %B
- month name, long form (
fst
frommonths
locale
),January
-December
%b
,%h
- month name, short form (
snd
frommonths
locale
),Jan
-Dec
%m
- month of year, 0-padded to two chars,
01
-12
%d
- day of month, 0-padded to two chars,
01
-31
%e
- day of month, space-padded to two chars,
1
-31
%j
- day of year, 0-padded to three chars,
001
-366
%f
- century for Week Date format, no padding. Note
%0f
and%_f
pad to two chars %V
- week of year for Week Date format, 0-padded to two chars,
01
-53
%U
- week of year where weeks start on Sunday (as
sundayStartWeek
), 0-padded to two chars,00
-53
%W
- week of year where weeks start on Monday (as
mondayStartWeek
), 0-padded to two chars,00
-53
Duration types
The specifiers for DiffTime
, NominalDiffTime
, CalendarDiffDays
, and CalendarDiffTime
are semantically
separate from the other types.
Specifiers on negative time differences will generally be negative (think rem
rather than mod
).
NominalDiffTime
and DiffTime
Note that a "minute" of DiffTime
is simply 60 SI seconds, rather than a minute of civil time.
Use NominalDiffTime
to work with civil time, ignoring any leap seconds.
For NominalDiffTime
and DiffTime
:
%w
- total whole weeks
%d
- total whole days
%D
- whole days of week
%h
- total whole hours
%H
- whole hours of day
%m
- total whole minutes
%M
- whole minutes of hour
%s
- total whole seconds
%Es
- total seconds, with decimal point and up to <width> (default 12) decimal places, without trailing zeros.
For a whole number of seconds,
%Es
omits the decimal point unless padding is specified. %0Es
- total seconds, with decimal point and <width> (default 12) decimal places.
%S
- whole seconds of minute
%ES
- seconds of minute, with decimal point and up to <width> (default 12) decimal places, without trailing zeros.
For a whole number of seconds,
%ES
omits the decimal point unless padding is specified. %0ES
- seconds of minute as two digits, with decimal point and <width> (default 12) decimal places.
CalendarDiffDays
For CalendarDiffDays
(and CalendarDiffTime
):
%y
- total years
%b
- total months
%B
- months of year
%w
- total weeks, not including months
%d
- total days, not including months
%D
- days of week
CalendarDiffTime
For CalendarDiffTime
:
%h
- total hours, not including months
%H
- hours of day
%m
- total minutes, not including months
%M
- minutes of hour
%s
- total whole seconds, not including months
%Es
- total seconds, not including months, with decimal point and up to <width> (default 12) decimal places, without trailing zeros.
For a whole number of seconds,
%Es
omits the decimal point unless padding is specified. %0Es
- total seconds, not including months, with decimal point and <width> (default 12) decimal places.
%S
- whole seconds of minute
%ES
- seconds of minute, with decimal point and up to <width> (default 12) decimal places, without trailing zeros.
For a whole number of seconds,
%ES
omits the decimal point unless padding is specified. %0ES
- seconds of minute as two digits, with decimal point and <width> (default 12) decimal places.
The class of types which can be parsed given a UNIX-style time format string.
Minimal complete definition
data TimeLocale Source #
Constructors
TimeLocale | |
Fields
|
Instances
Show TimeLocale | |
Defined in Data.Time.Format.Locale | |
Eq TimeLocale | |
Defined in Data.Time.Format.Locale Methods (==) :: TimeLocale -> TimeLocale -> Bool Source # (/=) :: TimeLocale -> TimeLocale -> Bool Source # | |
Ord TimeLocale | |
Defined in Data.Time.Format.Locale Methods compare :: TimeLocale -> TimeLocale -> Ordering Source # (<) :: TimeLocale -> TimeLocale -> Bool Source # (<=) :: TimeLocale -> TimeLocale -> Bool Source # (>) :: TimeLocale -> TimeLocale -> Bool Source # (>=) :: TimeLocale -> TimeLocale -> Bool Source # max :: TimeLocale -> TimeLocale -> TimeLocale Source # min :: TimeLocale -> TimeLocale -> TimeLocale Source # |
rfc822DateFormat :: String Source #
Format string according to RFC822.
iso8601DateFormat :: Maybe String -> String Source #
Construct format string according to ISO-8601.
The Maybe String
argument allows to supply an optional time specification. E.g.:
iso8601DateFormat
Nothing == "%Y-%m-%d" -- i.e.YYYY-MM-DD
iso8601DateFormat
(Just "%H:%M:%S") == "%Y-%m-%dT%H:%M:%S" -- i.e.YYYY-MM-DDTHH:MM:SS
defaultTimeLocale :: TimeLocale Source #
Locale representing American usage.
knownTimeZones
contains only the ten time-zones mentioned in RFC 822 sec. 5:
"UT", "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", "PDT".
Note that the parsing functions will regardless parse "UTC", single-letter military time-zones, and +HHMM format.
A simple day and time aggregate, where the day is of the specified parameter, and the time is a TimeOfDay. Conversion of this (as local civil time) to UTC depends on the time zone. Conversion of this (as local mean time) to UT1 depends on the longitude.
Constructors
LocalTime | |
Fields
|
Instances
Data LocalTime | |
Defined in Data.Time.LocalTime.Internal.LocalTime Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LocalTime -> c LocalTime Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LocalTime Source # toConstr :: LocalTime -> Constr Source # dataTypeOf :: LocalTime -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LocalTime) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LocalTime) Source # gmapT :: (forall b. Data b => b -> b) -> LocalTime -> LocalTime Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LocalTime -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LocalTime -> r Source # gmapQ :: (forall d. Data d => d -> u) -> LocalTime -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> LocalTime -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> LocalTime -> m LocalTime Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LocalTime -> m LocalTime Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LocalTime -> m LocalTime Source # | |
Show LocalTime | |
NFData LocalTime | |
Defined in Data.Time.LocalTime.Internal.LocalTime | |
Eq LocalTime | |
Ord LocalTime | |
Defined in Data.Time.LocalTime.Internal.LocalTime |
utcToLocalTime :: TimeZone -> UTCTime -> LocalTime Source #
Get the local time of a UTC time in a time zone.
ut1ToLocalTime :: Rational -> UniversalTime -> LocalTime Source #
Get the local time of a UT1 time on a particular meridian (in degrees, positive is East).
localTimeToUTC :: TimeZone -> LocalTime -> UTCTime Source #
Get the UTC time of a local time in a time zone.
localTimeToUT1 :: Rational -> LocalTime -> UniversalTime Source #
Get the UT1 time of a local time on a particular meridian (in degrees, positive is East).
diffLocalTime :: LocalTime -> LocalTime -> NominalDiffTime Source #
diffLocalTime a b = a - b
addLocalTime :: NominalDiffTime -> LocalTime -> LocalTime Source #
addLocalTime a b = a + b
Time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day.
Constructors
TimeOfDay | |
Instances
Data TimeOfDay | |
Defined in Data.Time.LocalTime.Internal.TimeOfDay Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TimeOfDay -> c TimeOfDay Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TimeOfDay Source # toConstr :: TimeOfDay -> Constr Source # dataTypeOf :: TimeOfDay -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TimeOfDay) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeOfDay) Source # gmapT :: (forall b. Data b => b -> b) -> TimeOfDay -> TimeOfDay Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TimeOfDay -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TimeOfDay -> r Source # gmapQ :: (forall d. Data d => d -> u) -> TimeOfDay -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> TimeOfDay -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay Source # | |
Show TimeOfDay | |
NFData TimeOfDay | |
Defined in Data.Time.LocalTime.Internal.TimeOfDay | |
Eq TimeOfDay | |
Ord TimeOfDay | |
Defined in Data.Time.LocalTime.Internal.TimeOfDay |
utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay) Source #
Convert a time of day in UTC to a time of day in some timezone, together with a day adjustment.
timeToTimeOfDay :: DiffTime -> TimeOfDay Source #
Get the time of day given a time since midnight. Time more than 24h will be converted to leap-seconds.
timeToDaysAndTimeOfDay :: NominalDiffTime -> (Integer, TimeOfDay) Source #
Convert a period of time into a count of days and a time of day since midnight. The time of day will never have a leap second.
timeOfDayToTime :: TimeOfDay -> DiffTime Source #
Get the time since midnight for a given time of day.
timeOfDayToDayFraction :: TimeOfDay -> Rational Source #
Get the fraction of a day since midnight given a time of day.
localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay) Source #
Convert a time of day in some timezone to a time of day in UTC, together with a day adjustment.
daysAndTimeOfDayToTime :: Integer -> TimeOfDay -> NominalDiffTime Source #
Convert a count of days and a time of day since midnight into a period of time.
dayFractionToTimeOfDay :: Rational -> TimeOfDay Source #
Get the time of day given the fraction of a day since midnight.
A TimeZone is a whole number of minutes offset from UTC, together with a name and a "just for summer" flag.
Constructors
TimeZone | |
Fields
|
Instances
Data TimeZone | |
Defined in Data.Time.LocalTime.Internal.TimeZone Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TimeZone -> c TimeZone Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TimeZone Source # toConstr :: TimeZone -> Constr Source # dataTypeOf :: TimeZone -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TimeZone) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeZone) Source # gmapT :: (forall b. Data b => b -> b) -> TimeZone -> TimeZone Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TimeZone -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TimeZone -> r Source # gmapQ :: (forall d. Data d => d -> u) -> TimeZone -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> TimeZone -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone Source # | |
Show TimeZone | This only shows the time zone name, or offset if the name is empty. |
NFData TimeZone | |
Defined in Data.Time.LocalTime.Internal.TimeZone | |
Eq TimeZone | |
Ord TimeZone | |
Defined in Data.Time.LocalTime.Internal.TimeZone |
timeZoneOffsetString' :: Maybe Char -> TimeZone -> String Source #
Text representing the offset of this timezone, such as "-0800" or "+0400" (like %z
in formatTime), with arbitrary padding.
timeZoneOffsetString :: TimeZone -> String Source #
Text representing the offset of this timezone, such as "-0800" or "+0400" (like %z
in formatTime).
minutesToTimeZone :: Int -> TimeZone Source #
Create a nameless non-summer timezone for this number of minutes.
hoursToTimeZone :: Int -> TimeZone Source #
Create a nameless non-summer timezone for this number of hours.
data CalendarDiffTime Source #
Constructors
CalendarDiffTime | |
Fields
|
Instances
scaleCalendarDiffTime :: Integer -> CalendarDiffTime -> CalendarDiffTime Source #
Scale by a factor. Note that scaleCalendarDiffTime (-1)
will not perfectly invert a duration, due to variable month lengths.
diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime Source #
diffUTCTime a b = a - b
addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime Source #
addUTCTime a b = a + b
newtype UniversalTime Source #
The Modified Julian Date is the day with the fraction of the day, measured from UT midnight. It's used to represent UT1, which is time as measured by the earth's rotation, adjusted for various wobbles.
Constructors
ModJulianDate | |
Fields |
Instances
This is the simplest representation of UTC. It consists of the day number, and a time offset from midnight. Note that if a day has a leap second added to it, it will have 86401 seconds.
Constructors
UTCTime | |
Fields
|
Instances
Data UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UTCTime -> c UTCTime Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UTCTime Source # toConstr :: UTCTime -> Constr Source # dataTypeOf :: UTCTime -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UTCTime) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UTCTime) Source # gmapT :: (forall b. Data b => b -> b) -> UTCTime -> UTCTime Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r Source # gmapQ :: (forall d. Data d => d -> u) -> UTCTime -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCTime -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime Source # | |
NFData UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime | |
Eq UTCTime | |
Ord UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime |
getTime_resolution :: DiffTime Source #
The resolution of getSystemTime
, getCurrentTime
, getPOSIXTime
data NominalDiffTime Source #
This is a length of time, as measured by UTC. It has a precision of 10^-12 s.
Conversion functions will treat it as seconds.
For example, (0.010 :: NominalDiffTime)
corresponds to 10 milliseconds.
It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), regardless of whether a leap-second intervened.
Instances
secondsToNominalDiffTime :: Pico -> NominalDiffTime Source #
Create a NominalDiffTime
from a number of seconds.
Since: time-1.9.1
nominalDiffTimeToSeconds :: NominalDiffTime -> Pico Source #
Get the seconds in a NominalDiffTime
.
Since: time-1.9.1
nominalDay :: NominalDiffTime Source #
One day in NominalDiffTime
.
This is a length of time, as measured by a clock. Conversion functions will treat it as seconds. It has a precision of 10^-12 s.
Instances
secondsToDiffTime :: Integer -> DiffTime Source #
Create a DiffTime
which represents an integral number of seconds.
picosecondsToDiffTime :: Integer -> DiffTime Source #
Create a DiffTime
from a number of picoseconds.
Instances
Enum DayOfWeek | "Circular", so for example |
Defined in Data.Time.Calendar.Week Methods succ :: DayOfWeek -> DayOfWeek Source # pred :: DayOfWeek -> DayOfWeek Source # toEnum :: Int -> DayOfWeek Source # fromEnum :: DayOfWeek -> Int Source # enumFrom :: DayOfWeek -> [DayOfWeek] Source # enumFromThen :: DayOfWeek -> DayOfWeek -> [DayOfWeek] Source # enumFromTo :: DayOfWeek -> DayOfWeek -> [DayOfWeek] Source # enumFromThenTo :: DayOfWeek -> DayOfWeek -> DayOfWeek -> [DayOfWeek] Source # | |
Read DayOfWeek | |
Show DayOfWeek | |
Eq DayOfWeek | |
toGregorian :: Day -> (Integer, Int, Int) Source #
Convert to proleptic Gregorian calendar. First element of result is year, second month number (1-12), third day (1-31).
showGregorian :: Day -> String Source #
Show in ISO 8601 format (yyyy-mm-dd)
gregorianMonthLength :: Integer -> Int -> Int Source #
The number of days in a given month according to the proleptic Gregorian calendar. First argument is year, second is month.
fromGregorianValid :: Integer -> Int -> Int -> Maybe Day Source #
Convert from proleptic Gregorian calendar. First argument is year, second month number (1-12), third day (1-31). Invalid values will return Nothing
fromGregorian :: Integer -> Int -> Int -> Day Source #
Convert from proleptic Gregorian calendar. First argument is year, second month number (1-12), third day (1-31). Invalid values will be clipped to the correct range, month first, then day.
diffGregorianDurationRollOver :: Day -> Day -> CalendarDiffDays Source #
Calendrical difference, with as many whole months as possible.
Same as diffGregorianDurationClip
for positive durations.
diffGregorianDurationClip :: Day -> Day -> CalendarDiffDays Source #
Calendrical difference, with as many whole months as possible
addGregorianYearsRollOver :: Integer -> Day -> Day Source #
Add years, matching month and day, with Feb 29th rolled over to Mar 1st if necessary. For instance, 2004-02-29 + 2 years = 2006-03-01.
addGregorianYearsClip :: Integer -> Day -> Day Source #
Add years, matching month and day, with Feb 29th clipped to Feb 28th if necessary. For instance, 2004-02-29 + 2 years = 2006-02-28.
addGregorianMonthsRollOver :: Integer -> Day -> Day Source #
Add months, with days past the last day of the month rolling over to the next month. For instance, 2005-01-30 + 1 month = 2005-03-02.
addGregorianMonthsClip :: Integer -> Day -> Day Source #
Add months, with days past the last day of the month clipped to the last day. For instance, 2005-01-30 + 1 month = 2005-02-28.
addGregorianDurationRollOver :: CalendarDiffDays -> Day -> Day Source #
Add months (rolling over to next month), then add days
addGregorianDurationClip :: CalendarDiffDays -> Day -> Day Source #
Add months (clipped to last day), then add days
isLeapYear :: Integer -> Bool Source #
Is this year a leap year according to the proleptic Gregorian calendar?
The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17.
Constructors
ModifiedJulianDay | |
Fields |
Instances
Data Day | |
Defined in Data.Time.Calendar.Days Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Day -> c Day Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Day Source # toConstr :: Day -> Constr Source # dataTypeOf :: Day -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Day) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Day) Source # gmapT :: (forall b. Data b => b -> b) -> Day -> Day Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Day -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Day -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Day -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Day -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Day -> m Day Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Day -> m Day Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Day -> m Day Source # | |
Enum Day | |
Defined in Data.Time.Calendar.Days | |
Ix Day | |
NFData Day | |
Defined in Data.Time.Calendar.Days | |
Eq Day | |
Ord Day | |
data CalendarDiffDays Source #
Constructors
CalendarDiffDays | |
Instances
scaleCalendarDiffDays :: Integer -> CalendarDiffDays -> CalendarDiffDays Source #
Scale by a factor. Note that scaleCalendarDiffDays (-1)
will not perfectly invert a duration, due to variable month lengths.
getCurrentTime :: MonadIO m => m UTCTime Source #
getCurrentTimeZone :: MonadIO m => m TimeZone Source #
getZonedTime :: MonadIO m => m ZonedTime Source #