Support parsing of dates in yyyy-dd-mm format

This commit is contained in:
tim 2008-12-09 07:15:18 +00:00
parent 22728c5c07
commit 250c92f646

View File

@ -198,12 +198,14 @@ startofyear day = fromGregorian y 1 1 where (y,_,_) = toGregorian day
parsedatetime :: String -> UTCTime
parsedatetime s =
parsetimewith "%Y/%m/%d %H:%M:%S" s $
parsetimewith "%Y-%m-%d %H:%M:%S" s $
error $ printf "could not parse timestamp \"%s\"" s
-- | Parse a date string to a time type, or raise an error.
parsedate :: String -> Day
parsedate s =
parsetimewith "%Y/%m/%d" s $
parsetimewith "%Y-%m-%d" s $
error $ printf "could not parse date \"%s\"" s
-- | Parse a time string to a time type using the provided pattern, or