| Safe Haskell | None | 
|---|
Text.XML.XSD.DateTime
Description
XSD dateTime data structure http://www.w3.org/TR/xmlschema-2/#dateTime
- data DateTime
 - isoEither :: Iso' (Either UTCTime LocalTime) DateTime
 - isoEither' :: Iso' (Either LocalTime UTCTime) DateTime
 - fold :: (LocalTime -> a) -> (UTCTime -> a) -> DateTime -> a
 - pUTCTime :: Prism' DateTime UTCTime
 - pLocalTime :: Prism' DateTime LocalTime
 - dateTime :: Prism' Text DateTime
 - dateTime' :: Text -> Either String DateTime
 - isZoned :: DateTime -> Bool
 - isUnzoned :: DateTime -> Bool
 - fromZonedTime :: ZonedTime -> DateTime
 - toUTCTime :: DateTime -> Maybe UTCTime
 - fromUTCTime :: UTCTime -> DateTime
 - toLocalTime :: DateTime -> Maybe LocalTime
 - fromLocalTime :: LocalTime -> DateTime
 - utcTime' :: Text -> Either String UTCTime
 - utcTime :: Text -> Maybe UTCTime
 - localTime' :: Text -> Either String LocalTime
 - localTime :: Text -> Maybe LocalTime
 
Documentation
XSD dateTime data structure
 http://www.w3.org/TR/xmlschema-2/#dateTime. Briefly, a dateTime
 uses the Gregorian calendar and may or may not have an associated
 timezone. If it has a timezone, then the canonical representation
 of that date time is in UTC.
Note, it is not possible to establish a total order on dateTime
 since non-timezoned are considered to belong to some unspecified
 timezone.
isoEither :: Iso' (Either UTCTime LocalTime) DateTimeSource
The isomorphism between a DateTime and Either UTCTime LocalTime
isoEither' :: Iso' (Either LocalTime UTCTime) DateTimeSource
The isomorphism between a DateTime and Either LocalTime UTCTime
pLocalTime :: Prism' DateTime LocalTimeSource
A prism that views the LocalTime component of a DateTime.
dateTime :: Prism' Text DateTimeSource
A prism that parses the string into a DateTime and converts the
 DateTime into a string.
Just (DtZoned t) == (dateTime # fromUTCTime t) ^? dateTime
Just (DtUnzoned t) == (dateTime # fromLocalTime t) ^? dateTime
>>>"2009-10-10T03:10:10-05:00" ^? dateTimeJust 2009-10-10T08:10:10Z
>>>"2119-10-10T03:10:10.4-13:26" ^? dateTimeJust 2119-10-10T16:36:10.4Z
>>>"0009-10-10T03:10:10.783952+14:00" ^? dateTimeJust 0009-10-09T13:10:10.783952Z
>>>"2009-10-10T03:10:10Z" ^? dateTimeJust 2009-10-10T03:10:10Z
>>>"-2009-05-10T21:08:59+05:00" ^? dateTimeJust -2009-05-10T16:08:59Z
>>>"-19399-12-31T13:10:10-14:00" ^? dateTimeJust -19398-01-01T03:10:10Z
>>>"2009-12-31T13:10:10" ^? dateTimeJust 2009-12-31T13:10:10
>>>"2012-10-15T24:00:00" ^? dateTimeJust 2012-10-16T00:00:00
>>>"2002-10-10T12:00:00+05:00" ^? dateTimeJust 2002-10-10T07:00:00Z
>>>"2002-10-10T00:00:00+05:00" ^? dateTimeJust 2002-10-09T19:00:00Z
>>>"-0001-10-10T00:00:00" ^? dateTimeJust 000-1-10-10T00:00:00
>>>"0001-10-10T00:00:00" ^? dateTimeJust 0001-10-10T00:00:00
>>>"2009-10-10T03:10:10-05" ^? dateTimeNothing
>>>"2009-10-10T03:10:10+14:50" ^? dateTimeNothing
>>>"2009-10-10T03:10:1" ^? dateTimeNothing
>>>"2009-10-10T03:1:10" ^? dateTimeNothing
>>>"2009-10-10T0:10:10" ^? dateTimeNothing
>>>"2009-10-1T10:10:10" ^? dateTimeNothing
>>>"2009-1-10T10:10:10" ^? dateTimeNothing
>>>"209-10-10T03:10:10" ^? dateTimeNothing
>>>"2009-10-10T24:10:10" ^? dateTimeNothing
>>>"0000-01-01T00:00:00" ^? dateTimeNothing
>>>"2009-13-01T00:00:00" ^? dateTimeNothing
>>>"+2009-10-01T04:20:40" ^? dateTimeNothing
>>>"002009-10-01T04:20:40" ^? dateTimeNothing
>>>dateTime # fromUTCTime (mkUTC 2119 10 10 16 36 10.4)"2119-10-10T16:36:10.4Z"
>>>dateTime # fromZonedTime (mkZoned 2010 04 07 13 47 20.001 2 0)"2010-04-07T11:47:20.001Z"
>>>dateTime # fromLocalTime (mkLocal 13 2 4 20 20 20)"0013-02-04T20:20:20"
>>>(dateTime #) `fmap` ("2010-04-07T13:47:20.001+02:00" ^? dateTime) -- issue 2Just "2010-04-07T11:47:20.001Z"
dateTime' :: Text -> Either String DateTimeSource
Parses the string into a dateTime or may fail with a parse error.
fromZonedTime :: ZonedTime -> DateTimeSource
Converts a zoned time to a dateTime.
toUTCTime :: DateTime -> Maybe UTCTimeSource
Attempts to convert a dateTime to a UTC time. The attempt fails
 if the given dateTime is non-timezoned.
fromUTCTime :: UTCTime -> DateTimeSource
Converts a UTC time to a timezoned dateTime.
toLocalTime :: DateTime -> Maybe LocalTimeSource
Attempts to convert a dateTime to a local time. The attempt
 fails if the given dateTime is timezoned.
fromLocalTime :: LocalTime -> DateTimeSource
Converts a local time to a non-timezoned dateTime.
utcTime' :: Text -> Either String UTCTimeSource
Parses the string in a dateTime then converts to a UTC time and
 may fail with a parse error.
utcTime :: Text -> Maybe UTCTimeSource
Parses the string in a dateTime then converts to a UTC time and
 may fail.