chronos-1.0: A performant time library

Safe HaskellNone
LanguageHaskell2010

Chronos

Contents

Synopsis

Functions

Current

today :: IO Day Source #

Gets the current Day. This does not take the user's time zone into account.

Construction

datetimeFromYmdhms :: Int -> Int -> Int -> Int -> Int -> Int -> Datetime Source #

Construct a Datetime from year, month, day, hour, minute, second:

>>> datetimeFromYmdhms 2014 2 26 17 58 52
foobar

timeFromYmdhms :: Int -> Int -> Int -> Int -> Int -> Int -> Time Source #

Conversion

timeToDayTruncate :: Time -> Day Source #

Convert Time to Day. This function is lossy; consequently, it does not roundtrip with dayToTimeMidnight.

dayToTimeMidnight :: Day -> Time Source #

Convert midnight of the given Day to Time.

dayToDate :: Day -> Date Source #

Convert Day to a Date.

dateToDay :: Date -> Day Source #

Convert Date to a Day.

Build Timespan

Matching

buildDayOfWeekMatch :: a -> a -> a -> a -> a -> a -> a -> DayOfWeekMatch a Source #

buildMonthMatch :: a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> MonthMatch a Source #

Format

The formats provided is this module are language-agnostic. To find meridiem formats and month formats, look in a language-specific module.

Months

Days of Week

Textual Conversion

Date

Text

builder_Ymd :: Maybe Char -> Date -> Builder Source #

This could be written much more efficiently since we know the exact size the resulting Text will be.

UTF-8 ByteString

Time of Day

Text

parser_HMS_opt_S :: Maybe Char -> Parser TimeOfDay Source #

Parses text that is formatted as either of the following:

  • %H:%M
  • %H:%M:%S

That is, the seconds and subseconds part is optional. If it is not provided, it is assumed to be zero. This format shows up in Google Chrome's datetime-local inputs.

UTF-8 ByteString

parserUtf8_HMS_opt_S :: Maybe Char -> Parser TimeOfDay Source #

Parses text that is formatted as either of the following:

  • %H:%M
  • %H:%M:%S

That is, the seconds and subseconds part is optional. If it is not provided, it is assumed to be zero. This format shows up in Google Chrome's datetime-local inputs.

Datetime

Text

builder_YmdHMS :: SubsecondPrecision -> DatetimeFormat -> Datetime -> Builder Source #

This could be written much more efficiently since we know the exact size the resulting Text will be.

UTF-8 ByteString

Offset Datetime

Text

UTF-8 ByteString