rio-0.1.22.0: A standard library for Haskell

Safe Haskell | Safe-Inferred
Language | Haskell2010

RIO.Time

Synopsis

- pattern May :: MonthOfYear
- formatTime :: FormatTime t => TimeLocale -> String -> t -> String
- fromGregorian :: Year -> MonthOfYear -> DayOfMonth -> Day
- data CalendarDiffDays = CalendarDiffDays {
  - cdMonths :: Integer
  - cdDays :: Integer
  }
- calendarDay :: CalendarDiffDays
- calendarWeek :: CalendarDiffDays
- calendarMonth :: CalendarDiffDays
- calendarYear :: CalendarDiffDays
- scaleCalendarDiffDays :: Integer -> CalendarDiffDays -> CalendarDiffDays
- class Ord p => DayPeriod p where
  - periodFirstDay :: p -> Day
  - periodLastDay :: p -> Day
  - dayPeriod :: Day -> p
- newtype Day = ModifiedJulianDay {
  - toModifiedJulianDay :: Integer
  }
- addDays :: Integer -> Day -> Day
- diffDays :: Day -> Day -> Integer
- periodAllDays :: DayPeriod p => p -> [Day]
- periodLength :: DayPeriod p => p -> Int
- periodFromDay :: DayPeriod p => Day -> (p, Int)
- periodToDay :: DayPeriod p => p -> Int -> Day
- periodToDayValid :: DayPeriod p => p -> Int -> Maybe Day
- type DayOfMonth = Int
- type MonthOfYear = Int
- type Year = Integer
- pattern December :: MonthOfYear
- pattern November :: MonthOfYear
- pattern October :: MonthOfYear
- pattern September :: MonthOfYear
- pattern August :: MonthOfYear
- pattern July :: MonthOfYear
- pattern June :: MonthOfYear
- pattern April :: MonthOfYear
- pattern March :: MonthOfYear
- pattern February :: MonthOfYear
- pattern January :: MonthOfYear
- pattern BeforeCommonEra :: Integer -> Year
- pattern CommonEra :: Integer -> Year
- isLeapYear :: Year -> Bool
- pattern YearMonthDay :: Year -> MonthOfYear -> DayOfMonth -> Day
- toGregorian :: Day -> (Year, MonthOfYear, DayOfMonth)
- fromGregorianValid :: Year -> MonthOfYear -> DayOfMonth -> Maybe Day
- showGregorian :: Day -> String
- gregorianMonthLength :: Year -> MonthOfYear -> DayOfMonth
- addGregorianMonthsClip :: Integer -> Day -> Day
- addGregorianMonthsRollOver :: Integer -> Day -> Day
- addGregorianYearsClip :: Integer -> Day -> Day
- addGregorianYearsRollOver :: Integer -> Day -> Day
- addGregorianDurationClip :: CalendarDiffDays -> Day -> Day
- addGregorianDurationRollOver :: CalendarDiffDays -> Day -> Day
- diffGregorianDurationClip :: Day -> Day -> CalendarDiffDays
- diffGregorianDurationRollOver :: Day -> Day -> CalendarDiffDays
- data DayOfWeek
  - = Monday
  - | Tuesday
  - | Wednesday
  - | Thursday
  - | Friday
  - | Saturday
  - | Sunday
- dayOfWeek :: Day -> DayOfWeek
- dayOfWeekDiff :: DayOfWeek -> DayOfWeek -> Int
- firstDayOfWeekOnAfter :: DayOfWeek -> Day -> Day
- weekAllDays :: DayOfWeek -> Day -> [Day]
- weekFirstDay :: DayOfWeek -> Day -> Day
- weekLastDay :: DayOfWeek -> Day -> Day
- data DiffTime
- secondsToDiffTime :: Integer -> DiffTime
- picosecondsToDiffTime :: Integer -> DiffTime
- diffTimeToPicoseconds :: DiffTime -> Integer
- data NominalDiffTime
- secondsToNominalDiffTime :: Pico -> NominalDiffTime
- nominalDiffTimeToSeconds :: NominalDiffTime -> Pico
- nominalDay :: NominalDiffTime
- getTime_resolution :: DiffTime
- data UTCTime = UTCTime {
  - utctDay :: Day
  - utctDayTime :: DiffTime
  }
- newtype UniversalTime = ModJulianDate {
  - getModJulianDate :: Rational
  }
- addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime
- diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime
- data CalendarDiffTime = CalendarDiffTime {
  - ctMonths :: Integer
  - ctTime :: NominalDiffTime
  }
- calendarTimeDays :: CalendarDiffDays -> CalendarDiffTime
- calendarTimeTime :: NominalDiffTime -> CalendarDiffTime
- scaleCalendarDiffTime :: Integer -> CalendarDiffTime -> CalendarDiffTime
- data TimeZone = TimeZone {
  - timeZoneMinutes :: Int
  - timeZoneSummerOnly :: Bool
  - timeZoneName :: String
  }
- minutesToTimeZone :: Int -> TimeZone
- hoursToTimeZone :: Int -> TimeZone
- timeZoneOffsetString' :: Maybe Char -> TimeZone -> String
- timeZoneOffsetString :: TimeZone -> String
- utc :: TimeZone
- data TimeOfDay = TimeOfDay {
  - todHour :: Int
  - todMin :: Int
  - todSec :: Pico
  }
- midnight :: TimeOfDay
- midday :: TimeOfDay
- makeTimeOfDayValid :: Int -> Int -> Pico -> Maybe TimeOfDay
- timeToDaysAndTimeOfDay :: NominalDiffTime -> (Integer, TimeOfDay)
- daysAndTimeOfDayToTime :: Integer -> TimeOfDay -> NominalDiffTime
- utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)
- localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)
- timeToTimeOfDay :: DiffTime -> TimeOfDay
- pastMidnight :: DiffTime -> TimeOfDay
- timeOfDayToTime :: TimeOfDay -> DiffTime
- sinceMidnight :: TimeOfDay -> DiffTime
- dayFractionToTimeOfDay :: Rational -> TimeOfDay
- timeOfDayToDayFraction :: TimeOfDay -> Rational
- data LocalTime = LocalTime {
  - localDay :: Day
  - localTimeOfDay :: TimeOfDay
  }
- addLocalTime :: NominalDiffTime -> LocalTime -> LocalTime
- diffLocalTime :: LocalTime -> LocalTime -> NominalDiffTime
- utcToLocalTime :: TimeZone -> UTCTime -> LocalTime
- localTimeToUTC :: TimeZone -> LocalTime -> UTCTime
- ut1ToLocalTime :: Rational -> UniversalTime -> LocalTime
- localTimeToUT1 :: Rational -> LocalTime -> UniversalTime
- data TimeLocale = TimeLocale {
  - wDays :: [(String, String)]
  - months :: [(String, String)]
  - amPm :: (String, String)
  - dateTimeFmt :: String
  - dateFmt :: String
  - timeFmt :: String
  - time12Fmt :: String
  - knownTimeZones :: [TimeZone]
  }
- defaultTimeLocale :: TimeLocale
- iso8601DateFormat :: Maybe String -> String
- rfc822DateFormat :: String
- class ParseTime t
- class FormatTime t
- data ZonedTime = ZonedTime {
  - zonedTimeToLocalTime :: LocalTime
  - zonedTimeZone :: TimeZone
  }
- utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime
- zonedTimeToUTC :: ZonedTime -> UTCTime
- parseTimeM :: (MonadFail m, ParseTime t) => Bool -> TimeLocale -> String -> String -> m t
- parseTimeMultipleM :: (MonadFail m, ParseTime t) => Bool -> TimeLocale -> [(String, String)] -> m t
- parseTimeOrError :: ParseTime t => Bool -> TimeLocale -> String -> String -> t
- readSTime :: ParseTime t => Bool -> TimeLocale -> String -> ReadS t
- readPTime :: ParseTime t => Bool -> TimeLocale -> String -> ReadP t
- 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

pattern May :: MonthOfYear #

formatTime :: FormatTime t => TimeLocale -> String -> t -> String #

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` from `wDays` `locale`), `Sun` - `Sat`
`%A`
  day of week, long form (`fst` from `wDays` `locale`), `Sunday` - `Saturday`

### `Month`

For `Month` (and `Day` and `LocalTime` and `ZonedTime` and `UTCTime` and `UniversalTime`):

`%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` from `months` `locale`), `January` - `December`
`%b`, `%h`
  month name, short form (`snd` from `months` `locale`), `Jan` - `Dec`
`%m`
  month of year, 0-padded to two chars, `01` - `12`

### `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`)
`%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.

fromGregorian :: Year -> MonthOfYear -> DayOfMonth -> Day #

Convert from proleptic Gregorian calendar. Invalid values will be clipped to the correct range, month first, then day.

data CalendarDiffDays #

Constructors

CalendarDiffDays |
Fields cdMonths :: Integer cdDays :: Integer

#### Instances

Instances details

Data CalendarDiffDays | Since: time-1.9.2
Instance details Defined in Data.Time.Calendar.CalendarDiffDays Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CalendarDiffDays -> c CalendarDiffDays # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CalendarDiffDays # toConstr :: CalendarDiffDays -> Constr # dataTypeOf :: CalendarDiffDays -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CalendarDiffDays) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CalendarDiffDays) # gmapT :: (forall b. Data b => b -> b) -> CalendarDiffDays -> CalendarDiffDays # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CalendarDiffDays -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CalendarDiffDays -> r # gmapQ :: (forall d. Data d => d -> u) -> CalendarDiffDays -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CalendarDiffDays -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CalendarDiffDays -> m CalendarDiffDays # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CalendarDiffDays -> m CalendarDiffDays # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CalendarDiffDays -> m CalendarDiffDays #
Monoid CalendarDiffDays | Additive
Instance details Defined in Data.Time.Calendar.CalendarDiffDays Methods mempty :: CalendarDiffDays # mappend :: CalendarDiffDays -> CalendarDiffDays -> CalendarDiffDays # mconcat :: [CalendarDiffDays] -> CalendarDiffDays #
Semigroup CalendarDiffDays | Additive
Instance details Defined in Data.Time.Calendar.CalendarDiffDays Methods (<>) :: CalendarDiffDays -> CalendarDiffDays -> CalendarDiffDays # sconcat :: NonEmpty CalendarDiffDays -> CalendarDiffDays # stimes :: Integral b => b -> CalendarDiffDays -> CalendarDiffDays #
Show CalendarDiffDays |
Instance details Defined in Data.Time.Calendar.CalendarDiffDays Methods showsPrec :: Int -> CalendarDiffDays -> ShowS # show :: CalendarDiffDays -> String # showList :: [CalendarDiffDays] -> ShowS #
NFData CalendarDiffDays |
Instance details Defined in Data.Time.Calendar.CalendarDiffDays Methods rnf :: CalendarDiffDays -> () #
Eq CalendarDiffDays |
Instance details Defined in Data.Time.Calendar.CalendarDiffDays Methods (==) :: CalendarDiffDays -> CalendarDiffDays -> Bool # (/=) :: CalendarDiffDays -> CalendarDiffDays -> Bool #
ISO8601 CalendarDiffDays | `PyYmMdD` (ISO 8601:2004(E) sec. 4.4.3.2)
Instance details Defined in Data.Time.Format.ISO8601 Methods iso8601Format :: Format CalendarDiffDays #

calendarDay :: CalendarDiffDays #

calendarWeek :: CalendarDiffDays #

calendarMonth :: CalendarDiffDays #

calendarYear :: CalendarDiffDays #

scaleCalendarDiffDays :: Integer -> CalendarDiffDays -> CalendarDiffDays #

Scale by a factor. Note that `scaleCalendarDiffDays (-1)` will not perfectly invert a duration, due to variable month lengths.

class Ord p => DayPeriod p where #

The class of types which can be represented as a period of days.

Since: time-1.12.1

Methods

periodFirstDay :: p -> Day #

Returns the first `Day` in a period of days.

periodLastDay :: p -> Day #

Returns the last `Day` in a period of days.

dayPeriod :: Day -> p #

Get the period this day is in.

#### Instances

Instances details

DayPeriod Day |
Instance details Defined in Data.Time.Calendar.Days Methods periodFirstDay :: Day -> Day # periodLastDay :: Day -> Day # dayPeriod :: Day -> Day #
DayPeriod Month |
Instance details Defined in Data.Time.Calendar.Month Methods periodFirstDay :: Month -> Day # periodLastDay :: Month -> Day # dayPeriod :: Day -> Month #
DayPeriod Quarter |
Instance details Defined in Data.Time.Calendar.Quarter Methods periodFirstDay :: Quarter -> Day # periodLastDay :: Quarter -> Day # dayPeriod :: Day -> Quarter #

newtype Day #

The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17.

Constructors

ModifiedJulianDay |
Fields toModifiedJulianDay :: Integer

#### Instances

Instances details

Data Day |
Instance details 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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Day # toConstr :: Day -> Constr # dataTypeOf :: Day -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Day) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Day) # gmapT :: (forall b. Data b => b -> b) -> Day -> Day # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Day -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Day -> r # gmapQ :: (forall d. Data d => d -> u) -> Day -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Day -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Day -> m Day # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Day -> m Day # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Day -> m Day #
Enum Day |
Instance details Defined in Data.Time.Calendar.Days Methods succ :: Day -> Day # pred :: Day -> Day # toEnum :: Int -> Day # fromEnum :: Day -> Int # enumFrom :: Day -> [Day] # enumFromThen :: Day -> Day -> [Day] # enumFromTo :: Day -> Day -> [Day] # enumFromThenTo :: Day -> Day -> Day -> [Day] #
Ix Day |
Instance details Defined in Data.Time.Calendar.Days Methods range :: (Day, Day) -> [Day] # index :: (Day, Day) -> Day -> Int # unsafeIndex :: (Day, Day) -> Day -> Int # inRange :: (Day, Day) -> Day -> Bool # rangeSize :: (Day, Day) -> Int # unsafeRangeSize :: (Day, Day) -> Int #
NFData Day |
Instance details Defined in Data.Time.Calendar.Days Methods rnf :: Day -> () #
Eq Day |
Instance details Defined in Data.Time.Calendar.Days Methods (==) :: Day -> Day -> Bool # (/=) :: Day -> Day -> Bool #
Ord Day |
Instance details Defined in Data.Time.Calendar.Days Methods compare :: Day -> Day -> Ordering # (<) :: Day -> Day -> Bool # (<=) :: Day -> Day -> Bool # (>) :: Day -> Day -> Bool # (>=) :: Day -> Day -> Bool # max :: Day -> Day -> Day # min :: Day -> Day -> Day #
DayPeriod Day |
Instance details Defined in Data.Time.Calendar.Days Methods periodFirstDay :: Day -> Day # periodLastDay :: Day -> Day # dayPeriod :: Day -> Day #
ISO8601 Day | `yyyy-mm-dd` (ISO 8601:2004(E) sec. 4.1.2.2 extended format)
Instance details Defined in Data.Time.Format.ISO8601 Methods iso8601Format :: Format Day #

addDays :: Integer -> Day -> Day #

diffDays :: Day -> Day -> Integer #

periodAllDays :: DayPeriod p => p -> [Day] #

A list of all the days in this period.

Since: time-1.12.1

periodLength :: DayPeriod p => p -> Int #

The number of days in this period.

Since: time-1.12.1

periodFromDay :: DayPeriod p => Day -> (p, Int) #

Get the period this day is in, with the 1-based day number within the period.

    periodFromDay (periodFirstDay p) = (p,1)

Since: time-1.12.1

periodToDay :: DayPeriod p => p -> Int -> Day #

Inverse of `periodFromDay`.

Since: time-1.12.1

periodToDayValid :: DayPeriod p => p -> Int -> Maybe Day #

Validating inverse of `periodFromDay`.

Since: time-1.12.1

type DayOfMonth = Int #

Day of month, in range 1 to 31.

type MonthOfYear = Int #

Month of year, in range 1 (January) to 12 (December).

type Year = Integer #

Year of Common Era (when positive).

pattern December :: MonthOfYear #

The twelve `MonthOfYear` patterns form a `COMPLETE` set.

pattern November :: MonthOfYear #

pattern October :: MonthOfYear #

pattern September :: MonthOfYear #

pattern August :: MonthOfYear #

pattern July :: MonthOfYear #

pattern June :: MonthOfYear #

pattern April :: MonthOfYear #

pattern March :: MonthOfYear #

pattern February :: MonthOfYear #

pattern January :: MonthOfYear #

pattern BeforeCommonEra :: Integer -> Year #

Also known as Before Christ. Note that Year 1 = 1 CE, and the previous Year 0 = 1 BCE. `CommonEra` and `BeforeCommonEra` form a `COMPLETE` set.

pattern CommonEra :: Integer -> Year #

Also known as Anno Domini.

isLeapYear :: Year -> Bool #

Is this year a leap year according to the proleptic Gregorian calendar?

pattern YearMonthDay :: Year -> MonthOfYear -> DayOfMonth -> Day #

Bidirectional abstract constructor for the proleptic Gregorian calendar. Invalid values will be clipped to the correct range, month first, then day.

toGregorian :: Day -> (Year, MonthOfYear, DayOfMonth) #

Convert to proleptic Gregorian calendar.

fromGregorianValid :: Year -> MonthOfYear -> DayOfMonth -> Maybe Day #

Convert from proleptic Gregorian calendar. Invalid values will return Nothing

showGregorian :: Day -> String #

Show in ISO 8601 format (yyyy-mm-dd)

gregorianMonthLength :: Year -> MonthOfYear -> DayOfMonth #

The number of days in a given month according to the proleptic Gregorian calendar.

addGregorianMonthsClip :: Integer -> Day -> Day #

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.

addGregorianMonthsRollOver :: Integer -> Day -> Day #

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.

addGregorianYearsClip :: Integer -> Day -> Day #

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.

addGregorianYearsRollOver :: Integer -> Day -> Day #

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.

addGregorianDurationClip :: CalendarDiffDays -> Day -> Day #

Add months (clipped to last day), then add days

addGregorianDurationRollOver :: CalendarDiffDays -> Day -> Day #

Add months (rolling over to next month), then add days

diffGregorianDurationClip :: Day -> Day -> CalendarDiffDays #

Calendrical difference, with as many whole months as possible

diffGregorianDurationRollOver :: Day -> Day -> CalendarDiffDays #

Calendrical difference, with as many whole months as possible. Same as `diffGregorianDurationClip` for positive durations.

data DayOfWeek #

Constructors

Monday |
Tuesday |
Wednesday |
Thursday |
Friday |
Saturday |
Sunday |

#### Instances

Instances details

Data DayOfWeek |
Instance details Defined in Data.Time.Calendar.Week Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DayOfWeek -> c DayOfWeek # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DayOfWeek # toConstr :: DayOfWeek -> Constr # dataTypeOf :: DayOfWeek -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DayOfWeek) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DayOfWeek) # gmapT :: (forall b. Data b => b -> b) -> DayOfWeek -> DayOfWeek # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DayOfWeek -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DayOfWeek -> r # gmapQ :: (forall d. Data d => d -> u) -> DayOfWeek -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> DayOfWeek -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DayOfWeek -> m DayOfWeek # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DayOfWeek -> m DayOfWeek # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DayOfWeek -> m DayOfWeek #
Enum DayOfWeek | "Circular", so for example `[Tuesday ..]` gives an endless sequence. Also: `fromEnum` gives [1 .. 7] for [Monday .. Sunday], and `toEnum` performs mod 7 to give a cycle of days.
Instance details Defined in Data.Time.Calendar.Week Methods succ :: DayOfWeek -> DayOfWeek # pred :: DayOfWeek -> DayOfWeek # toEnum :: Int -> DayOfWeek # fromEnum :: DayOfWeek -> Int # enumFrom :: DayOfWeek -> [DayOfWeek] # enumFromThen :: DayOfWeek -> DayOfWeek -> [DayOfWeek] # enumFromTo :: DayOfWeek -> DayOfWeek -> [DayOfWeek] # enumFromThenTo :: DayOfWeek -> DayOfWeek -> DayOfWeek -> [DayOfWeek] #
Ix DayOfWeek |
Instance details Defined in Data.Time.Calendar.Week Methods range :: (DayOfWeek, DayOfWeek) -> [DayOfWeek] # index :: (DayOfWeek, DayOfWeek) -> DayOfWeek -> Int # unsafeIndex :: (DayOfWeek, DayOfWeek) -> DayOfWeek -> Int # inRange :: (DayOfWeek, DayOfWeek) -> DayOfWeek -> Bool # rangeSize :: (DayOfWeek, DayOfWeek) -> Int # unsafeRangeSize :: (DayOfWeek, DayOfWeek) -> Int #
Read DayOfWeek |
Instance details Defined in Data.Time.Calendar.Week Methods readsPrec :: Int -> ReadS DayOfWeek # readList :: ReadS [DayOfWeek] # readPrec :: ReadPrec DayOfWeek # readListPrec :: ReadPrec [DayOfWeek] #
Show DayOfWeek |
Instance details Defined in Data.Time.Calendar.Week Methods showsPrec :: Int -> DayOfWeek -> ShowS # show :: DayOfWeek -> String # showList :: [DayOfWeek] -> ShowS #
NFData DayOfWeek |
Instance details Defined in Data.Time.Calendar.Week Methods rnf :: DayOfWeek -> () #
Eq DayOfWeek |
Instance details Defined in Data.Time.Calendar.Week Methods (==) :: DayOfWeek -> DayOfWeek -> Bool # (/=) :: DayOfWeek -> DayOfWeek -> Bool #
Ord DayOfWeek |
Instance details Defined in Data.Time.Calendar.Week Methods compare :: DayOfWeek -> DayOfWeek -> Ordering # (<) :: DayOfWeek -> DayOfWeek -> Bool # (<=) :: DayOfWeek -> DayOfWeek -> Bool # (>) :: DayOfWeek -> DayOfWeek -> Bool # (>=) :: DayOfWeek -> DayOfWeek -> Bool # max :: DayOfWeek -> DayOfWeek -> DayOfWeek # min :: DayOfWeek -> DayOfWeek -> DayOfWeek #

dayOfWeek :: Day -> DayOfWeek #

dayOfWeekDiff :: DayOfWeek -> DayOfWeek -> Int #

`dayOfWeekDiff a b = a - b` in range 0 to 6. The number of days from b to the next a.

firstDayOfWeekOnAfter :: DayOfWeek -> Day -> Day #

The first day-of-week on or after some day

weekAllDays :: DayOfWeek -> Day -> [Day] #

Returns a week containing the given `Day` where the first day is the `DayOfWeek` specified.

Examples:

    >>> weekAllDays Sunday (YearMonthDay 2022 02 21)
    [YearMonthDay 2022 2 20 .. YearMonthDay 2022 2 26]

    >>> weekAllDays Monday (YearMonthDay 2022 02 21)
    [YearMonthDay 2022 2 21 .. YearMonthDay 2022 2 27]

    >>> weekAllDays Tuesday (YearMonthDay 2022 02 21)
    [YearMonthDay 2022 2 15 .. YearMonthDay 2022 2 21]

Since: time-1.12.2

weekFirstDay :: DayOfWeek -> Day -> Day #

Returns the first day of a week containing the given `Day`.

Examples:

    >>> weekFirstDay Sunday (YearMonthDay 2022 02 21)
    YearMonthDay 2022 2 20

    >>> weekFirstDay Monday (YearMonthDay 2022 02 21)
    YearMonthDay 2022 2 21

    >>> weekFirstDay Tuesday (YearMonthDay 2022 02 21)
    YearMonthDay 2022 2 15

Since: time-1.12.2

weekLastDay :: DayOfWeek -> Day -> Day #

Returns the last day of a week containing the given `Day`.

Examples:

    >>> weekLastDay Sunday (YearMonthDay 2022 02 21)
    YearMonthDay 2022 2 26

    >>> weekLastDay Monday (YearMonthDay 2022 02 21)
    YearMonthDay 2022 2 27

    >>> weekLastDay Tuesday (YearMonthDay 2022 02 21)
    YearMonthDay 2022 2 21

Since: time-1.12.2

data DiffTime #

This is a length of time, as measured by a clock. Conversion functions such as `fromInteger` and `realToFrac` will treat it as seconds. For example, `(0.010 :: DiffTime)` corresponds to 10 milliseconds.

It has a precision of one picosecond (= 10^-12 s). Enumeration functions will treat it as picoseconds.

#### Instances

Instances details

Data DiffTime |
Instance details Defined in Data.Time.Clock.Internal.DiffTime Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DiffTime -> c DiffTime # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DiffTime # toConstr :: DiffTime -> Constr # dataTypeOf :: DiffTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DiffTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DiffTime) # gmapT :: (forall b. Data b => b -> b) -> DiffTime -> DiffTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DiffTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DiffTime -> r # gmapQ :: (forall d. Data d => d -> u) -> DiffTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> DiffTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DiffTime -> m DiffTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DiffTime -> m DiffTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DiffTime -> m DiffTime #
Enum DiffTime |
Instance details Defined in Data.Time.Clock.Internal.DiffTime Methods succ :: DiffTime -> DiffTime # pred :: DiffTime -> DiffTime # toEnum :: Int -> DiffTime # fromEnum :: DiffTime -> Int # enumFrom :: DiffTime -> [DiffTime] # enumFromThen :: DiffTime -> DiffTime -> [DiffTime] # enumFromTo :: DiffTime -> DiffTime -> [DiffTime] # enumFromThenTo :: DiffTime -> DiffTime -> DiffTime -> [DiffTime] #
Num DiffTime |
Instance details Defined in Data.Time.Clock.Internal.DiffTime Methods (+) :: DiffTime -> DiffTime -> DiffTime # (-) :: DiffTime -> DiffTime -> DiffTime # (*) :: DiffTime -> DiffTime -> DiffTime # negate :: DiffTime -> DiffTime # abs :: DiffTime -> DiffTime # signum :: DiffTime -> DiffTime # fromInteger :: Integer -> DiffTime #
Read DiffTime |
Instance details Defined in Data.Time.Clock.Internal.DiffTime Methods readsPrec :: Int -> ReadS DiffTime # readList :: ReadS [DiffTime] # readPrec :: ReadPrec DiffTime # readListPrec :: ReadPrec [DiffTime] #
Fractional DiffTime |
Instance details Defined in Data.Time.Clock.Internal.DiffTime Methods (/) :: DiffTime -> DiffTime -> DiffTime # recip :: DiffTime -> DiffTime # fromRational :: Rational -> DiffTime #
Real DiffTime |
Instance details Defined in Data.Time.Clock.Internal.DiffTime Methods toRational :: DiffTime -> Rational #
RealFrac DiffTime |
Instance details Defined in Data.Time.Clock.Internal.DiffTime Methods properFraction :: Integral b => DiffTime -> (b, DiffTime) # truncate :: Integral b => DiffTime -> b # round :: Integral b => DiffTime -> b # ceiling :: Integral b => DiffTime -> b # floor :: Integral b => DiffTime -> b #
Show DiffTime |
Instance details Defined in Data.Time.Clock.Internal.DiffTime Methods showsPrec :: Int -> DiffTime -> ShowS # show :: DiffTime -> String # showList :: [DiffTime] -> ShowS #
NFData DiffTime |
Instance details Defined in Data.Time.Clock.Internal.DiffTime Methods rnf :: DiffTime -> () #
Eq DiffTime |
Instance details Defined in Data.Time.Clock.Internal.DiffTime Methods (==) :: DiffTime -> DiffTime -> Bool # (/=) :: DiffTime -> DiffTime -> Bool #
Ord DiffTime |
Instance details Defined in Data.Time.Clock.Internal.DiffTime Methods compare :: DiffTime -> DiffTime -> Ordering # (<) :: DiffTime -> DiffTime -> Bool # (<=) :: DiffTime -> DiffTime -> Bool # (>) :: DiffTime -> DiffTime -> Bool # (>=) :: DiffTime -> DiffTime -> Bool # max :: DiffTime -> DiffTime -> DiffTime # min :: DiffTime -> DiffTime -> DiffTime #

secondsToDiffTime :: Integer -> DiffTime #

Create a `DiffTime` which represents an integral number of seconds.

picosecondsToDiffTime :: Integer -> DiffTime #

Create a `DiffTime` from a number of picoseconds.

diffTimeToPicoseconds :: DiffTime -> Integer #

Get the number of picoseconds in a `DiffTime`.

data NominalDiffTime #

This is a length of time, as measured by UTC. It has a precision of 10^-12 s.

Conversion functions such as `fromInteger` and `realToFrac` will treat it as seconds. For example, `(0.010 :: NominalDiffTime)` corresponds to 10 milliseconds.

It has a precision of one picosecond (= 10^-12 s). Enumeration functions will treat it as picoseconds.

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

Instances details

Data NominalDiffTime |
Instance details Defined in Data.Time.Clock.Internal.NominalDiffTime Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NominalDiffTime -> c NominalDiffTime # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c NominalDiffTime # toConstr :: NominalDiffTime -> Constr # dataTypeOf :: NominalDiffTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c NominalDiffTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NominalDiffTime) # gmapT :: (forall b. Data b => b -> b) -> NominalDiffTime -> NominalDiffTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NominalDiffTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NominalDiffTime -> r # gmapQ :: (forall d. Data d => d -> u) -> NominalDiffTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> NominalDiffTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> NominalDiffTime -> m NominalDiffTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NominalDiffTime -> m NominalDiffTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NominalDiffTime -> m NominalDiffTime #
Enum NominalDiffTime |
Instance details Defined in Data.Time.Clock.Internal.NominalDiffTime Methods succ :: NominalDiffTime -> NominalDiffTime # pred :: NominalDiffTime -> NominalDiffTime # toEnum :: Int -> NominalDiffTime # fromEnum :: NominalDiffTime -> Int # enumFrom :: NominalDiffTime -> [NominalDiffTime] # enumFromThen :: NominalDiffTime -> NominalDiffTime -> [NominalDiffTime] # enumFromTo :: NominalDiffTime -> NominalDiffTime -> [NominalDiffTime] # enumFromThenTo :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime -> [NominalDiffTime] #
Num NominalDiffTime |
Instance details Defined in Data.Time.Clock.Internal.NominalDiffTime Methods (+) :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # (-) :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # (*) :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # negate :: NominalDiffTime -> NominalDiffTime # abs :: NominalDiffTime -> NominalDiffTime # signum :: NominalDiffTime -> NominalDiffTime # fromInteger :: Integer -> NominalDiffTime #
Read NominalDiffTime |
Instance details Defined in Data.Time.Clock.Internal.NominalDiffTime Methods readsPrec :: Int -> ReadS NominalDiffTime # readList :: ReadS [NominalDiffTime] # readPrec :: ReadPrec NominalDiffTime # readListPrec :: ReadPrec [NominalDiffTime] #
Fractional NominalDiffTime |
Instance details Defined in Data.Time.Clock.Internal.NominalDiffTime Methods (/) :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # recip :: NominalDiffTime -> NominalDiffTime # fromRational :: Rational -> NominalDiffTime #
Real NominalDiffTime |
Instance details Defined in Data.Time.Clock.Internal.NominalDiffTime Methods toRational :: NominalDiffTime -> Rational #
RealFrac NominalDiffTime |
Instance details Defined in Data.Time.Clock.Internal.NominalDiffTime Methods properFraction :: Integral b => NominalDiffTime -> (b, NominalDiffTime) # truncate :: Integral b => NominalDiffTime -> b # round :: Integral b => NominalDiffTime -> b # ceiling :: Integral b => NominalDiffTime -> b # floor :: Integral b => NominalDiffTime -> b #
Show NominalDiffTime |
Instance details Defined in Data.Time.Clock.Internal.NominalDiffTime Methods showsPrec :: Int -> NominalDiffTime -> ShowS # show :: NominalDiffTime -> String # showList :: [NominalDiffTime] -> ShowS #
NFData NominalDiffTime |
Instance details Defined in Data.Time.Clock.Internal.NominalDiffTime Methods rnf :: NominalDiffTime -> () #
Eq NominalDiffTime |
Instance details Defined in Data.Time.Clock.Internal.NominalDiffTime Methods (==) :: NominalDiffTime -> NominalDiffTime -> Bool # (/=) :: NominalDiffTime -> NominalDiffTime -> Bool #
Ord NominalDiffTime |
Instance details Defined in Data.Time.Clock.Internal.NominalDiffTime Methods compare :: NominalDiffTime -> NominalDiffTime -> Ordering # (<) :: NominalDiffTime -> NominalDiffTime -> Bool # (<=) :: NominalDiffTime -> NominalDiffTime -> Bool # (>) :: NominalDiffTime -> NominalDiffTime -> Bool # (>=) :: NominalDiffTime -> NominalDiffTime -> Bool # max :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # min :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime #

secondsToNominalDiffTime :: Pico -> NominalDiffTime #

Create a `NominalDiffTime` from a number of seconds.

Since: time-1.9.1

nominalDiffTimeToSeconds :: NominalDiffTime -> Pico #

Get the seconds in a `NominalDiffTime`.

Since: time-1.9.1

nominalDay :: NominalDiffTime #

One day in `NominalDiffTime`.

getTime_resolution :: DiffTime #

The resolution of `getSystemTime`, `getCurrentTime`, `getPOSIXTime`. On UNIX systems this uses `clock_getres`, which may be wrong on WSL2.

data UTCTime #

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 utctDay :: Day the day utctDayTime :: DiffTime the time from midnight, 0 <= t < 86401s (because of leap-seconds)

#### Instances

Instances details

Data UTCTime |
Instance details 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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UTCTime # toConstr :: UTCTime -> Constr # dataTypeOf :: UTCTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UTCTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UTCTime) # gmapT :: (forall b. Data b => b -> b) -> UTCTime -> UTCTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r # gmapQ :: (forall d. Data d => d -> u) -> UTCTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime #
NFData UTCTime |
Instance details Defined in Data.Time.Clock.Internal.UTCTime Methods rnf :: UTCTime -> () #
Eq UTCTime |
Instance details Defined in Data.Time.Clock.Internal.UTCTime Methods (==) :: UTCTime -> UTCTime -> Bool # (/=) :: UTCTime -> UTCTime -> Bool #
Ord UTCTime |
Instance details Defined in Data.Time.Clock.Internal.UTCTime Methods compare :: UTCTime -> UTCTime -> Ordering # (<) :: UTCTime -> UTCTime -> Bool # (<=) :: UTCTime -> UTCTime -> Bool # (>) :: UTCTime -> UTCTime -> Bool # (>=) :: UTCTime -> UTCTime -> Bool # max :: UTCTime -> UTCTime -> UTCTime # min :: UTCTime -> UTCTime -> UTCTime #
ISO8601 UTCTime | `yyyy-mm-ddThh:mm:ss[.sss]Z` (ISO 8601:2004(E) sec. 4.3.2 extended format)
Instance details Defined in Data.Time.Format.ISO8601 Methods iso8601Format :: Format UTCTime #

newtype UniversalTime #

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 getModJulianDate :: Rational

#### Instances

Instances details

Data UniversalTime |
Instance details Defined in Data.Time.Clock.Internal.UniversalTime Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UniversalTime -> c UniversalTime # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UniversalTime # toConstr :: UniversalTime -> Constr # dataTypeOf :: UniversalTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UniversalTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UniversalTime) # gmapT :: (forall b. Data b => b -> b) -> UniversalTime -> UniversalTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UniversalTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UniversalTime -> r # gmapQ :: (forall d. Data d => d -> u) -> UniversalTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UniversalTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UniversalTime -> m UniversalTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UniversalTime -> m UniversalTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UniversalTime -> m UniversalTime #
NFData UniversalTime |
Instance details Defined in Data.Time.Clock.Internal.UniversalTime Methods rnf :: UniversalTime -> () #
Eq UniversalTime |
Instance details Defined in Data.Time.Clock.Internal.UniversalTime Methods (==) :: UniversalTime -> UniversalTime -> Bool # (/=) :: UniversalTime -> UniversalTime -> Bool #
Ord UniversalTime |
Instance details Defined in Data.Time.Clock.Internal.UniversalTime Methods compare :: UniversalTime -> UniversalTime -> Ordering # (<) :: UniversalTime -> UniversalTime -> Bool # (<=) :: UniversalTime -> UniversalTime -> Bool # (>) :: UniversalTime -> UniversalTime -> Bool # (>=) :: UniversalTime -> UniversalTime -> Bool # max :: UniversalTime -> UniversalTime -> UniversalTime # min :: UniversalTime -> UniversalTime -> UniversalTime #

addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime #

addUTCTime a b = a + b

diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime #

diffUTCTime a b = a - b

data CalendarDiffTime #

Constructors

CalendarDiffTime |
Fields ctMonths :: Integer ctTime :: NominalDiffTime

#### Instances

Instances details

Data CalendarDiffTime | Since: time-1.9.2
Instance details Defined in Data.Time.LocalTime.Internal.CalendarDiffTime Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CalendarDiffTime -> c CalendarDiffTime # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CalendarDiffTime # toConstr :: CalendarDiffTime -> Constr # dataTypeOf :: CalendarDiffTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CalendarDiffTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CalendarDiffTime) # gmapT :: (forall b. Data b => b -> b) -> CalendarDiffTime -> CalendarDiffTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CalendarDiffTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CalendarDiffTime -> r # gmapQ :: (forall d. Data d => d -> u) -> CalendarDiffTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CalendarDiffTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CalendarDiffTime -> m CalendarDiffTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CalendarDiffTime -> m CalendarDiffTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CalendarDiffTime -> m CalendarDiffTime #
Monoid CalendarDiffTime | Additive
Instance details Defined in Data.Time.LocalTime.Internal.CalendarDiffTime Methods mempty :: CalendarDiffTime # mappend :: CalendarDiffTime -> CalendarDiffTime -> CalendarDiffTime # mconcat :: [CalendarDiffTime] -> CalendarDiffTime #
Semigroup CalendarDiffTime | Additive
Instance details Defined in Data.Time.LocalTime.Internal.CalendarDiffTime Methods (<>) :: CalendarDiffTime -> CalendarDiffTime -> CalendarDiffTime # sconcat :: NonEmpty CalendarDiffTime -> CalendarDiffTime # stimes :: Integral b => b -> CalendarDiffTime -> CalendarDiffTime #
Show CalendarDiffTime |
Instance details Defined in Data.Time.LocalTime.Internal.CalendarDiffTime Methods showsPrec :: Int -> CalendarDiffTime -> ShowS # show :: CalendarDiffTime -> String # showList :: [CalendarDiffTime] -> ShowS #
NFData CalendarDiffTime |
Instance details Defined in Data.Time.LocalTime.Internal.CalendarDiffTime Methods rnf :: CalendarDiffTime -> () #
Eq CalendarDiffTime |
Instance details Defined in Data.Time.LocalTime.Internal.CalendarDiffTime Methods (==) :: CalendarDiffTime -> CalendarDiffTime -> Bool # (/=) :: CalendarDiffTime -> CalendarDiffTime -> Bool #
ISO8601 CalendarDiffTime | `PyYmMdDThHmMs[.sss]S` (ISO 8601:2004(E) sec. 4.4.3.2)
Instance details Defined in Data.Time.Format.ISO8601 Methods iso8601Format :: Format CalendarDiffTime #

calendarTimeDays :: CalendarDiffDays -> CalendarDiffTime #

calendarTimeTime :: NominalDiffTime -> CalendarDiffTime #

scaleCalendarDiffTime :: Integer -> CalendarDiffTime -> CalendarDiffTime #

Scale by a factor. Note that `scaleCalendarDiffTime (-1)` will not perfectly invert a duration, due to variable month lengths.

data TimeZone #

A TimeZone is a whole number of minutes offset from UTC, together with a name and a "just for summer" flag.

Constructors

TimeZone |
Fields timeZoneMinutes :: Int The number of minutes offset from UTC. Positive means local time will be later in the day than UTC. timeZoneSummerOnly :: Bool Is this time zone just persisting for the summer? timeZoneName :: String The name of the zone, typically a three- or four-letter acronym.

#### Instances

Instances details

Data TimeZone |
Instance details 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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TimeZone # toConstr :: TimeZone -> Constr # dataTypeOf :: TimeZone -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TimeZone) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeZone) # gmapT :: (forall b. Data b => b -> b) -> TimeZone -> TimeZone # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TimeZone -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TimeZone -> r # gmapQ :: (forall d. Data d => d -> u) -> TimeZone -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TimeZone -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone #
Show TimeZone | This only shows the time zone name, or offset if the name is empty.
Instance details Defined in Data.Time.LocalTime.Internal.TimeZone Methods showsPrec :: Int -> TimeZone -> ShowS # show :: TimeZone -> String # showList :: [TimeZone] -> ShowS #
NFData TimeZone |
Instance details Defined in Data.Time.LocalTime.Internal.TimeZone Methods rnf :: TimeZone -> () #
Eq TimeZone |
Instance details Defined in Data.Time.LocalTime.Internal.TimeZone Methods (==) :: TimeZone -> TimeZone -> Bool # (/=) :: TimeZone -> TimeZone -> Bool #
Ord TimeZone |
Instance details Defined in Data.Time.LocalTime.Internal.TimeZone Methods compare :: TimeZone -> TimeZone -> Ordering # (<) :: TimeZone -> TimeZone -> Bool # (<=) :: TimeZone -> TimeZone -> Bool # (>) :: TimeZone -> TimeZone -> Bool # (>=) :: TimeZone -> TimeZone -> Bool # max :: TimeZone -> TimeZone -> TimeZone # min :: TimeZone -> TimeZone -> TimeZone #
ISO8601 TimeZone | `±hh:mm` (ISO 8601:2004(E) sec. 4.2.5.1 extended format)
Instance details Defined in Data.Time.Format.ISO8601 Methods iso8601Format :: Format TimeZone #

minutesToTimeZone :: Int -> TimeZone #

Create a nameless non-summer timezone for this number of minutes.

hoursToTimeZone :: Int -> TimeZone #

Create a nameless non-summer timezone for this number of hours.

timeZoneOffsetString' :: Maybe Char -> TimeZone -> String #

Text representing the offset of this timezone, such as "-0800" or "+0400" (like `%z` in formatTime), with arbitrary padding.

timeZoneOffsetString :: TimeZone -> String #

Text representing the offset of this timezone, such as "-0800" or "+0400" (like `%z` in formatTime).

utc :: TimeZone #

The UTC time zone.

data TimeOfDay #

Time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day.

`TimeOfDay 24 0 0` is considered invalid for the purposes of `makeTimeOfDayValid`, as well as reading and parsing, but valid for ISO 8601 parsing in Data.Time.Format.ISO8601.

Constructors

TimeOfDay |
Fields todHour :: Int range 0 - 23 todMin :: Int range 0 - 59 todSec :: Pico Note that 0 <= `todSec` < 61, accomodating leap seconds. Any local minute may have a leap second, since leap seconds happen in all zones simultaneously

#### Instances

Instances details

Data TimeOfDay |
Instance details 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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TimeOfDay # toConstr :: TimeOfDay -> Constr # dataTypeOf :: TimeOfDay -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TimeOfDay) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeOfDay) # gmapT :: (forall b. Data b => b -> b) -> TimeOfDay -> TimeOfDay # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TimeOfDay -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TimeOfDay -> r # gmapQ :: (forall d. Data d => d -> u) -> TimeOfDay -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TimeOfDay -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay #
Show TimeOfDay |
Instance details Defined in Data.Time.LocalTime.Internal.TimeOfDay Methods showsPrec :: Int -> TimeOfDay -> ShowS # show :: TimeOfDay -> String # showList :: [TimeOfDay] -> ShowS #
NFData TimeOfDay |
Instance details Defined in Data.Time.LocalTime.Internal.TimeOfDay Methods rnf :: TimeOfDay -> () #
Eq TimeOfDay |
Instance details Defined in Data.Time.LocalTime.Internal.TimeOfDay Methods (==) :: TimeOfDay -> TimeOfDay -> Bool # (/=) :: TimeOfDay -> TimeOfDay -> Bool #
Ord TimeOfDay |
Instance details Defined in Data.Time.LocalTime.Internal.TimeOfDay Methods compare :: TimeOfDay -> TimeOfDay -> Ordering # (<) :: TimeOfDay -> TimeOfDay -> Bool # (<=) :: TimeOfDay -> TimeOfDay -> Bool # (>) :: TimeOfDay -> TimeOfDay -> Bool # (>=) :: TimeOfDay -> TimeOfDay -> Bool # max :: TimeOfDay -> TimeOfDay -> TimeOfDay # min :: TimeOfDay -> TimeOfDay -> TimeOfDay #
ISO8601 TimeOfDay | `hh:mm:ss[.sss]` (ISO 8601:2004(E) sec. 4.2.2.2, 4.2.2.4(a) extended format)
Instance details Defined in Data.Time.Format.ISO8601 Methods iso8601Format :: Format TimeOfDay #

midnight :: TimeOfDay #

Hour zero

midday :: TimeOfDay #

Hour twelve

makeTimeOfDayValid :: Int -> Int -> Pico -> Maybe TimeOfDay #

timeToDaysAndTimeOfDay :: NominalDiffTime -> (Integer, TimeOfDay) #

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.

daysAndTimeOfDayToTime :: Integer -> TimeOfDay -> NominalDiffTime #

Convert a count of days and a time of day since midnight into a period of time.

utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay) #

Convert a time of day in UTC to a time of day in some timezone, together with a day adjustment.

localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay) #

Convert a time of day in some timezone to a time of day in UTC, together with a day adjustment.

timeToTimeOfDay :: DiffTime -> TimeOfDay #

Get the time of day given a time since midnight. Time more than 24h will be converted to leap-seconds.

pastMidnight :: DiffTime -> TimeOfDay #

Same as `timeToTimeOfDay`.

timeOfDayToTime :: TimeOfDay -> DiffTime #

Get the time since midnight for a given time of day.

sinceMidnight :: TimeOfDay -> DiffTime #

Same as `timeOfDayToTime`.

dayFractionToTimeOfDay :: Rational -> TimeOfDay #

Get the time of day given the fraction of a day since midnight.

timeOfDayToDayFraction :: TimeOfDay -> Rational #

Get the fraction of a day since midnight given a time of day.

data LocalTime #

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 localDay :: Day localTimeOfDay :: TimeOfDay

#### Instances

Instances details

Data LocalTime |
Instance details 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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LocalTime # toConstr :: LocalTime -> Constr # dataTypeOf :: LocalTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LocalTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LocalTime) # gmapT :: (forall b. Data b => b -> b) -> LocalTime -> LocalTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LocalTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LocalTime -> r # gmapQ :: (forall d. Data d => d -> u) -> LocalTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> LocalTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> LocalTime -> m LocalTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LocalTime -> m LocalTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LocalTime -> m LocalTime #
Show LocalTime |
Instance details Defined in Data.Time.LocalTime.Internal.LocalTime Methods showsPrec :: Int -> LocalTime -> ShowS # show :: LocalTime -> String # showList :: [LocalTime] -> ShowS #
NFData LocalTime |
Instance details Defined in Data.Time.LocalTime.Internal.LocalTime Methods rnf :: LocalTime -> () #
Eq LocalTime |
Instance details Defined in Data.Time.LocalTime.Internal.LocalTime Methods (==) :: LocalTime -> LocalTime -> Bool # (/=) :: LocalTime -> LocalTime -> Bool #
Ord LocalTime |
Instance details Defined in Data.Time.LocalTime.Internal.LocalTime Methods compare :: LocalTime -> LocalTime -> Ordering # (<) :: LocalTime -> LocalTime -> Bool # (<=) :: LocalTime -> LocalTime -> Bool # (>) :: LocalTime -> LocalTime -> Bool # (>=) :: LocalTime -> LocalTime -> Bool # max :: LocalTime -> LocalTime -> LocalTime # min :: LocalTime -> LocalTime -> LocalTime #
ISO8601 LocalTime | `yyyy-mm-ddThh:mm:ss[.sss]` (ISO 8601:2004(E) sec. 4.3.2 extended format)
Instance details Defined in Data.Time.Format.ISO8601 Methods iso8601Format :: Format LocalTime #

addLocalTime :: NominalDiffTime -> LocalTime -> LocalTime #

addLocalTime a b = a + b

diffLocalTime :: LocalTime -> LocalTime -> NominalDiffTime #

diffLocalTime a b = a - b

utcToLocalTime :: TimeZone -> UTCTime -> LocalTime #

Get the local time of a UTC time in a time zone.

localTimeToUTC :: TimeZone -> LocalTime -> UTCTime #

Get the UTC time of a local time in a time zone.

ut1ToLocalTime :: Rational -> UniversalTime -> LocalTime #

Get the local time of a UT1 time on a particular meridian (in degrees, positive is East).

localTimeToUT1 :: Rational -> LocalTime -> UniversalTime #

Get the UT1 time of a local time on a particular meridian (in degrees, positive is East).

data TimeLocale #

Constructors

TimeLocale |
Fields wDays :: [(String, String)] full and abbreviated week days, starting with Sunday months :: [(String, String)] full and abbreviated months amPm :: (String, String) AM/PM symbols dateTimeFmt :: String formatting strings dateFmt :: String formatting strings timeFmt :: String formatting strings time12Fmt :: String formatting strings knownTimeZones :: [TimeZone] time zones known by name

#### Instances

Instances details

Show TimeLocale |
Instance details Defined in Data.Time.Format.Locale Methods showsPrec :: Int -> TimeLocale -> ShowS # show :: TimeLocale -> String # showList :: [TimeLocale] -> ShowS #
Eq TimeLocale |
Instance details Defined in Data.Time.Format.Locale Methods (==) :: TimeLocale -> TimeLocale -> Bool # (/=) :: TimeLocale -> TimeLocale -> Bool #
Ord TimeLocale |
Instance details Defined in Data.Time.Format.Locale Methods compare :: TimeLocale -> TimeLocale -> Ordering # (<) :: TimeLocale -> TimeLocale -> Bool # (<=) :: TimeLocale -> TimeLocale -> Bool # (>) :: TimeLocale -> TimeLocale -> Bool # (>=) :: TimeLocale -> TimeLocale -> Bool # max :: TimeLocale -> TimeLocale -> TimeLocale # min :: TimeLocale -> TimeLocale -> TimeLocale #

defaultTimeLocale :: TimeLocale #

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.

iso8601DateFormat :: Maybe String -> String #

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

rfc822DateFormat :: String #

Format string according to RFC822.

class ParseTime t #

The class of types which can be parsed given a UNIX-style time format string.

Minimal complete definition

parseTimeSpecifier, buildTime

class FormatTime t #

Minimal complete definition

formatCharacter

data ZonedTime #

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 zonedTimeToLocalTime :: LocalTime zonedTimeZone :: TimeZone

#### Instances

Instances details

Data ZonedTime |
Instance details 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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ZonedTime # toConstr :: ZonedTime -> Constr # dataTypeOf :: ZonedTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ZonedTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ZonedTime) # gmapT :: (forall b. Data b => b -> b) -> ZonedTime -> ZonedTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ZonedTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ZonedTime -> r # gmapQ :: (forall d. Data d => d -> u) -> ZonedTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ZonedTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ZonedTime -> m ZonedTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ZonedTime -> m ZonedTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ZonedTime -> m ZonedTime #
Show ZonedTime | For the time zone, this only shows the name, or offset if the name is empty.
Instance details Defined in Data.Time.LocalTime.Internal.ZonedTime Methods showsPrec :: Int -> ZonedTime -> ShowS # show :: ZonedTime -> String # showList :: [ZonedTime] -> ShowS #
NFData ZonedTime |
Instance details Defined in Data.Time.LocalTime.Internal.ZonedTime Methods rnf :: ZonedTime -> () #
ISO8601 ZonedTime | `yyyy-mm-ddThh:mm:ss[.sss]±hh:mm` (ISO 8601:2004(E) sec. 4.3.2 extended format)
Instance details Defined in Data.Time.Format.ISO8601 Methods iso8601Format :: Format ZonedTime #

utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime #

zonedTimeToUTC :: ZonedTime -> UTCTime #

parseTimeM #

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. Missing information will be derived from 1970-01-01 00:00 UTC (which was a Thursday). 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` `%Ez`
  accepts any of `±HHMM` or `±HH:MM`.
`%Z` `%EZ`
  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

parseTimeMultipleM #

Arguments

:: (MonadFail m, ParseTime t) |
=> Bool | Accept leading and trailing whitespace?
-> TimeLocale | Time locale.
-> [(String, String)] | Pairs of (format 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 list of pairs of format and input. Resulting value is constructed from all provided specifiers.

parseTimeOrError #

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.

readSTime #

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.

readPTime #

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.

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 #