hodatime-0.2.2.1: A fully featured date/time library based on Nodatime
Copyright(C) 2017 Jason Johnson
LicenseBSD-style (see the file LICENSE)
MaintainerJason Johnson <jason.johnson.081@gmail.com>
Stabilityexperimental
PortabilityPOSIX, Windows
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.HodaTime.ZonedDateTime

Description

This is the module for ZonedDateTime. A ZonedDateTime is a universal time, it represents the same moment anywhere in the world and is completely unambiguous. Each instance of a ZonedDateTime corresponds to exactly one point on a continuous time line.

Synopsis

Types

data ZonedDateTime cal Source #

A CalendarDateTime in a specific time zone. A ZonedDateTime is global and maps directly to a single Instant.

Instances

Instances details
Show (ZonedDateTime cal) Source # 
Instance details

Defined in Data.HodaTime.ZonedDateTime.Internal

Eq (ZonedDateTime cal) Source # 
Instance details

Defined in Data.HodaTime.ZonedDateTime.Internal

Methods

(==) :: ZonedDateTime cal -> ZonedDateTime cal -> Bool #

(/=) :: ZonedDateTime cal -> ZonedDateTime cal -> Bool #

Constructors

fromCalendarDateTimeLeniently :: (IsCalendar cal, IsCalendarDateTime cal) => CalendarDateTime cal -> TimeZone -> ZonedDateTime cal Source #

Returns the mapping of this CalendarDateTime within the given TimeZone, with "lenient" rules applied such that ambiguous values map to the earlier of the alternatives, and "skipped" values are shifted forward by the duration of the "gap".

fromCalendarDateTimeStrictly :: (MonadThrow m, IsCalendarDateTime cal) => CalendarDateTime cal -> TimeZone -> m (ZonedDateTime cal) Source #

Returns the mapping of this CalendarDateTime within the given TimeZone, with "strict" rules applied such that ambiguous or skipped date times return the requested failure response (e.g. Nothing, Left, exception, etc.)

fromInstant :: IsCalendarDateTime cal => Instant -> TimeZone -> ZonedDateTime cal Source #

Returns the ZonedDateTime represented by the passed Instant within the given TimeZone. This is always an unambiguous conversion.

Math

Conversion

toCalendarDate :: ZonedDateTime cal -> CalendarDate cal Source #

Return the CalendarDate represented by this ZonedDateTime.

toLocalTime :: ZonedDateTime cal -> LocalTime Source #

Return the LocalTime represented by this ZonedDateTime.

Accessors

inDst :: ZonedDateTime cal -> Bool Source #

Return a Bool specifying if this ZonedDateTime is currently in Daylight savings time.

zoneAbbreviation :: ZonedDateTime cal -> String Source #

Return a String representing the abbreviation for the TimeZone this ZonedDateTime is currently in.

year :: IsCalendar cal => ZonedDateTime cal -> Year Source #

Accessor for the Year of a ZonedDateTime.

month :: IsCalendar cal => ZonedDateTime cal -> Month cal Source #

Accessor for the Month of a ZonedDateTime.

day :: IsCalendar cal => ZonedDateTime cal -> DayOfMonth Source #

Accessor for the Day of a ZonedDateTime.

hour :: IsCalendar cal => ZonedDateTime cal -> Hour Source #

Accessor for the Hour of a ZonedDateTime.

minute :: IsCalendar cal => ZonedDateTime cal -> Minute Source #

Accessor for the Minute of a ZonedDateTime.

second :: IsCalendar cal => ZonedDateTime cal -> Second Source #

Accessor for the Second of a ZonedDateTime.

nanosecond :: IsCalendar cal => ZonedDateTime cal -> Nanosecond Source #

Accessor for the Nanosecond of a ZonedDateTime.

Special constructors

fromCalendarDateTimeAll :: IsCalendarDateTime cal => CalendarDateTime cal -> TimeZone -> [ZonedDateTime cal] Source #

Return all ZonedDateTime entries for a specific CalendarDateTime in a TimeZone. Normally this would be one, but in the case that a time occurs twice in a zone (i.e. due to daylight savings time change) both would be returned. Also, if the time does not occur at all, an empty list will be returned. This method allows the user to choose exactly what to do in the case of ambigiuty.

resolve :: IsCalendarDateTime cal => (ZonedDateTime cal -> ZonedDateTime cal -> ZonedDateTime cal) -> (ZonedDateTime cal -> ZonedDateTime cal -> ZonedDateTime cal) -> CalendarDateTime cal -> TimeZone -> ZonedDateTime cal Source #

Takes two functions to determine how to resolve a CalendarDateTime to a ZonedDateTime in the case of ambiguity or skipped times. The first function is for the ambigous case and is past the first matching ZonedDateTime, followed by the second match. The second function is for the case that the CalendarDateTime doesn't exist in the TimeZone (e.g. in a spring-forward situation, there will be a missing hour), the first ZonedDateTime will be the the last time before the gap and the second will be the first time after the gap.

Exceptions