formatting-7.2.0: Combinator-based type-safe formatting (like printf() or FORMAT)

Safe Haskell | None
Language | Haskell2010

Formatting.Time

Description

Formatters for time.

Synopsis

- tz :: FormatTime a => Format r (a -> r)
- tzName :: FormatTime a => Format r (a -> r)
- datetime :: FormatTime a => Format r (a -> r)
- hm :: FormatTime a => Format r (a -> r)
- hms :: FormatTime a => Format r (a -> r)
- hmsL :: FormatTime a => Format r (a -> r)
- hmsPL :: FormatTime a => Format r (a -> r)
- dayHalf :: FormatTime a => Format r (a -> r)
- dayHalfU :: FormatTime a => Format r (a -> r)
- hour24 :: FormatTime a => Format r (a -> r)
- hour12 :: FormatTime a => Format r (a -> r)
- hour24S :: FormatTime a => Format r (a -> r)
- hour12S :: FormatTime a => Format r (a -> r)
- minute :: FormatTime a => Format r (a -> r)
- second :: FormatTime a => Format r (a -> r)
- pico :: FormatTime a => Format r (a -> r)
- decimals :: FormatTime a => Format r (a -> r)
- epoch :: FormatTime a => Format r (a -> r)
- dateSlash :: FormatTime a => Format r (a -> r)
- dateDash :: FormatTime a => Format r (a -> r)
- dateSlashL :: FormatTime a => Format r (a -> r)
- year :: FormatTime a => Format r (a -> r)
- yy :: FormatTime a => Format r (a -> r)
- century :: FormatTime a => Format r (a -> r)
- monthName :: FormatTime a => Format r (a -> r)
- monthNameShort :: FormatTime a => Format r (a -> r)
- month :: FormatTime a => Format r (a -> r)
- dayOfMonth :: FormatTime a => Format r (a -> r)
- dayOfMonthOrd :: FormatTime a => Format r (a -> r)
- dayOfMonthS :: FormatTime a => Format r (a -> r)
- day :: FormatTime a => Format r (a -> r)
- weekYear :: FormatTime a => Format r (a -> r)
- weekYY :: FormatTime a => Format r (a -> r)
- weekCentury :: FormatTime a => Format r (a -> r)
- week :: FormatTime a => Format r (a -> r)
- dayOfWeek :: FormatTime a => Format r (a -> r)
- dayNameShort :: FormatTime a => Format r (a -> r)
- dayName :: FormatTime a => Format r (a -> r)
- weekFromZero :: FormatTime a => Format r (a -> r)
- dayOfWeekFromZero :: FormatTime a => Format r (a -> r)
- weekOfYearMon :: FormatTime a => Format r (a -> r)
- diff :: RealFrac n => Bool -> Format r (n -> r)
- years :: RealFrac n => Int -> Format r (n -> r)
- days :: RealFrac n => Int -> Format r (n -> r)
- hours :: RealFrac n => Int -> Format r (n -> r)
- minutes :: RealFrac n => Int -> Format r (n -> r)
- seconds :: RealFrac n => Int -> Format r (n -> r)
- diffComponents :: RealFrac n => Format r (n -> r)
- customDiffComponents :: RealFrac n => (forall r'. Format r' (Integer -> Integer -> Integer -> Integer -> r')) -> Format r (n -> r)
- fmt :: FormatTime a => Text -> a -> Text
- customTimeFmt :: FormatTime a => Text -> Format r (a -> r)

# Documentation

tz :: FormatTime a => Format r (a -> r) Source #

Timezone offset on the format `-HHMM`.

tzName :: FormatTime a => Format r (a -> r) Source #

Timezone name.

datetime :: FormatTime a => Format r (a -> r) Source #

As `dateTimeFmt` `locale` (e.g. `%a %b %e %H:%M:%S %Z %Y`).

hm :: FormatTime a => Format r (a -> r) Source #

Same as `%H:%M`.

hms :: FormatTime a => Format r (a -> r) Source #

Same as `%H:%M:%S`.

hmsL :: FormatTime a => Format r (a -> r) Source #

As `timeFmt` `locale` (e.g. `%H:%M:%S`).

hmsPL :: FormatTime a => Format r (a -> r) Source #

As `time12Fmt` `locale` (e.g. `%I:%M:%S %p`).

dayHalf :: FormatTime a => Format r (a -> r) Source #

Day half from (`amPm` `locale`), converted to lowercase, `am`, `pm`.

dayHalfU :: FormatTime a => Format r (a -> r) Source #

Day half from (`amPm` `locale`), `AM`, `PM`.

hour24 :: FormatTime a => Format r (a -> r) Source #

Hour, 24-hour, leading 0 as needed, `00` - `23`.

hour12 :: FormatTime a => Format r (a -> r) Source #

Hour, 12-hour, leading 0 as needed, `01` - `12`.

hour24S :: FormatTime a => Format r (a -> r) Source #

Hour, 24-hour, leading space as needed, `0` - `23`.

hour12S :: FormatTime a => Format r (a -> r) Source #

Hour, 12-hour, leading space as needed, `1` - `12`.

minute :: FormatTime a => Format r (a -> r) Source #

Minute, `00` - `59`.

second :: FormatTime a => Format r (a -> r) Source #

Second, without decimal part, `00` - `60`.

pico :: FormatTime a => Format r (a -> r) Source #

Picosecond, including trailing zeros, `000000000000` - `999999999999`.

decimals :: FormatTime a => Format r (a -> r) Source #

Decimal point and up to 12 second decimals, without trailing zeros. For a whole number of seconds, this produces the empty string.

epoch :: FormatTime a => Format r (a -> r) Source #

dateSlash :: FormatTime a => Format r (a -> r) Source #

Same as `%m/%d/%y`.

dateDash :: FormatTime a => Format r (a -> r) Source #

Same as `%Y-%m-%d`.

dateSlashL :: FormatTime a => Format r (a -> r) Source #

As `dateFmt` `locale` (e.g. `%m/%d/%y`).

year :: FormatTime a => Format r (a -> r) Source #

Year.

yy :: FormatTime a => Format r (a -> r) Source #

Last two digits of year, `00` - `99`.

century :: FormatTime a => Format r (a -> r) Source #

Century (being the first two digits of the year), `00` - `99`.

monthName :: FormatTime a => Format r (a -> r) Source #

Month name, long form (`fst` from `months` `locale`), `January` - `December`.

monthNameShort :: FormatTime a => Format r (a -> r) Source #

`%H] month name, short form (`snd` from `months`` locale`),` Jan`-` Dec@.

month :: FormatTime a => Format r (a -> r) Source #

Month of year, leading 0 as needed, `01` - `12`.

dayOfMonth :: FormatTime a => Format r (a -> r) Source #

Day of month, leading 0 as needed, `01` - `31`.

dayOfMonthOrd :: FormatTime a => Format r (a -> r) Source #

Day of month, `1st`, `2nd`, `25th`, etc.

dayOfMonthS :: FormatTime a => Format r (a -> r) Source #

Day of month, leading space as needed, `1` - `31`.

day :: FormatTime a => Format r (a -> r) Source #

Day of year for Ordinal Date format, `001` - `366`.

weekYear :: FormatTime a => Format r (a -> r) Source #

Year for Week Date format e.g. `2013`.

weekYY :: FormatTime a => Format r (a -> r) Source #

Last two digits of year for Week Date format, `00` - `99`.

weekCentury :: FormatTime a => Format r (a -> r) Source #

Century (first two digits of year) for Week Date format, `00` - `99`.

week :: FormatTime a => Format r (a -> r) Source #

Week for Week Date format, `01` - `53`.

dayOfWeek :: FormatTime a => Format r (a -> r) Source #

Day for Week Date format, `1` - `7`.

dayNameShort :: FormatTime a => Format r (a -> r) Source #

Day of week, short form (`snd` from `wDays` `locale`), `Sun` - `Sat`.

dayName :: FormatTime a => Format r (a -> r) Source #

Day of week, long form (`fst` from `wDays` `locale`), `Sunday` - `Saturday`.

weekFromZero :: FormatTime a => Format r (a -> r) Source #

Week number of year, where weeks start on Sunday (as `sundayStartWeek`), `00` - `53`.

dayOfWeekFromZero :: FormatTime a => Format r (a -> r) Source #

Day of week number, `0` (= Sunday) - `6` (= Saturday).

weekOfYearMon :: FormatTime a => Format r (a -> r) Source #

Week number of year, where weeks start on Monday (as `mondayStartWeek`), `00` - `53`.

diff Source #

Arguments

:: RealFrac n |
=> Bool | Display 'in/ago'?
-> Format r (n -> r) | Example: '3 seconds ago', 'in three days'.)

Display a time span as one time relative to another. Input is assumed to be seconds. Typical inputs are `NominalDiffTime` and `DiffTime`.

years Source #

Arguments

:: RealFrac n |
=> Int | Decimal places.
-> Format r (n -> r) |

Display the absolute value time span in years.

days Source #

Arguments

:: RealFrac n |
=> Int | Decimal places.
-> Format r (n -> r) |

Display the absolute value time span in days.

hours Source #

Arguments

:: RealFrac n |
=> Int | Decimal places.
-> Format r (n -> r) |

Display the absolute value time span in hours.

minutes Source #

Arguments

:: RealFrac n |
=> Int | Decimal places.
-> Format r (n -> r) |

Display the absolute value time span in minutes.

seconds Source #

Arguments

:: RealFrac n |
=> Int | Decimal places.
-> Format r (n -> r) |

Display the absolute value time span in seconds.

diffComponents :: RealFrac n => Format r (n -> r) Source #

Display seconds in the following pattern: `00:00:00:00`, which ranges from days to seconds.

customDiffComponents :: RealFrac n => (forall r'. Format r' (Integer -> Integer -> Integer -> Integer -> r')) -> Format r (n -> r) Source #

Variation of `diffComponents`, which lets you explicitly specify how to render each component.

fmt :: FormatTime a => Text -> a -> Text Source #

Formatter call. Probably don't want to use this.

customTimeFmt :: FormatTime a => Text -> Format r (a -> r) Source #

Helper for creating custom time formatters