+-- | Format W3C Date and Time strings.
module Data.Time.W3C.Format
( format
)
import Data.Time.W3C.Types
+-- | Format W3C Date and Time string from anything convertible to
+-- 'W3CDateTime' type. The most obvious acceptable type is the
+-- 'W3CDateTime' itself.
format :: Convertible t W3CDateTime => t -> String
format = format' . convert
where
, ":"
, case properFraction second :: (Int, Pico) of
(int, 0 ) -> show2 int
- (int, frac) -> show2 int ++ tail (show frac)
+ (int, frac) -> show2 int ++ tail (showFixed True frac)
, showTZ tz
]