| Safe Haskell | None |
|---|
Formatting.Time
Contents
Description
Formatters for time.
Example:
REPL> before <- getCurrentTime REPL> after <- getCurrentTime REPL> format (hms % " - " % hms % " = " % diff False) before after (before,after) "19:05:06 - 19:05:08 = 3 seconds" REPL>
- tz :: FormatTime a => Format a
- tzName :: FormatTime a => Format a
- datetime :: FormatTime a => Format a
- hm :: FormatTime a => Format a
- hms :: FormatTime a => Format a
- hmsL :: FormatTime a => Format a
- hmsPL :: FormatTime a => Format a
- dayHalf :: FormatTime a => Format a
- dayHalfU :: FormatTime a => Format a
- hour24 :: FormatTime a => Format a
- hour12 :: FormatTime a => Format a
- hour24S :: FormatTime a => Format a
- hour12S :: FormatTime a => Format a
- minute :: FormatTime a => Format a
- second :: FormatTime a => Format a
- pico :: FormatTime a => Format a
- decimals :: FormatTime a => Format a
- epoch :: FormatTime a => Format a
- dateSlash :: FormatTime a => Format a
- dateDash :: FormatTime a => Format a
- dateSlashL :: FormatTime a => Format a
- year :: FormatTime a => Format a
- yy :: FormatTime a => Format a
- century :: FormatTime a => Format a
- monthName :: FormatTime a => Format a
- monthNameShort :: FormatTime a => Format a
- month :: FormatTime a => Format a
- dayOfMonth :: FormatTime a => Format a
- dayOfMonthS :: FormatTime a => Format a
- day :: FormatTime a => Format a
- weekYear :: FormatTime a => Format a
- weekYY :: FormatTime a => Format a
- weekCentury :: FormatTime a => Format a
- week :: FormatTime a => Format a
- dayOfWeek :: FormatTime a => Format a
- dayNameShort :: FormatTime a => Format a
- dayName :: FormatTime a => Format a
- weekFromZero :: FormatTime a => Format a
- dayOfWeekFromZero :: FormatTime a => Format a
- weekOfYearMon :: FormatTime a => Format a
- diff :: Bool -> Format (UTCTime, UTCTime)
- fmt :: FormatTime a => Text -> a -> Text
For TimeZone (and ZonedTime and UTCTime):
tz :: FormatTime a => Format aSource
Timezone offset on the format -HHMM.
tzName :: FormatTime a => Format aSource
Timezone name.
datetime :: FormatTime a => Format aSource
As dateTimeFmt locale (e.g. %a %b %e %H:%M:%S %Z %Y).
For TimeOfDay (and LocalTime and ZonedTime and UTCTime):
hm :: FormatTime a => Format aSource
Same as %H:%M.
hms :: FormatTime a => Format aSource
Same as %H:%M:%S.
hmsL :: FormatTime a => Format aSource
As timeFmt locale (e.g. %H:%M:%S).
hmsPL :: FormatTime a => Format aSource
As time12Fmt locale (e.g. %I:%M:%S %p).
dayHalf :: FormatTime a => Format aSource
Day half from (amPm locale), converted to lowercase, am,
pm.
dayHalfU :: FormatTime a => Format aSource
Day half from (amPm locale), AM, PM.
hour24 :: FormatTime a => Format aSource
Hour, 24-hour, leading 0 as needed, 00 - 23.
hour12 :: FormatTime a => Format aSource
Hour, 12-hour, leading 0 as needed, 01 - 12.
hour24S :: FormatTime a => Format aSource
Hour, 24-hour, leading space as needed, 0 - 23.
hour12S :: FormatTime a => Format aSource
Hour, 12-hour, leading space as needed, 1 - 12.
minute :: FormatTime a => Format aSource
Minute, 00 - 59.
second :: FormatTime a => Format aSource
Second, without decimal part, 00 - 60.
pico :: FormatTime a => Format aSource
Picosecond, including trailing zeros, 000000000000 -
999999999999.
decimals :: FormatTime a => Format aSource
Decimal point and up to 12 second decimals, without trailing zeros. For a whole number of seconds, this produces the empty string.
For UTCTime and ZonedTime
epoch :: FormatTime a => Format aSource
For Day (and LocalTime and ZonedTime and UTCTime):
dateSlash :: FormatTime a => Format aSource
Same as %m/%d/%y.
dateDash :: FormatTime a => Format aSource
Same as %Y-%m-%d.
dateSlashL :: FormatTime a => Format aSource
As dateFmt locale (e.g. %m/%d/%y).
year :: FormatTime a => Format aSource
Year.
yy :: FormatTime a => Format aSource
Last two digits of year, 00 - 99.
century :: FormatTime a => Format aSource
Century (being the first two digits of the year), 00 - 99.
monthName :: FormatTime a => Format aSource
monthNameShort :: FormatTime a => Format aSource
month :: FormatTime a => Format aSource
Month of year, leading 0 as needed, 01 - 12.
dayOfMonth :: FormatTime a => Format aSource
Day of month, leading 0 as needed, 01 - 31.
dayOfMonthS :: FormatTime a => Format aSource
Day of month, leading space as needed, 1 - 31.
day :: FormatTime a => Format aSource
Day of year for Ordinal Date format, 001 - 366.
weekYear :: FormatTime a => Format aSource
Year for Week Date format e.g. 2013.
weekYY :: FormatTime a => Format aSource
Last two digits of year for Week Date format, 00 - 99.
weekCentury :: FormatTime a => Format aSource
Century (first two digits of year) for Week Date format, 00 -
99.
week :: FormatTime a => Format aSource
Week for Week Date format, 01 - 53.
dayOfWeek :: FormatTime a => Format aSource
Day for Week Date format, 1 - 7.
dayNameShort :: FormatTime a => Format aSource
dayName :: FormatTime a => Format aSource
weekFromZero :: FormatTime a => Format aSource
Week number of year, where weeks start on Sunday (as
sundayStartWeek), 00 - 53.
dayOfWeekFromZero :: FormatTime a => Format aSource
Day of week number, 0 (= Sunday) - 6 (= Saturday).
weekOfYearMon :: FormatTime a => Format aSource
Week number of year, where weeks start on Monday (as
mondayStartWeek), 00 - 53.
Arguments
| :: Bool | Display 'in/ago'? |
| -> Format (UTCTime, UTCTime) | Example: '3 seconds ago', 'in three days'. |
Display a time span as one time relative to another. Equiv. to (t1 - t2) for some (t1,t2) pair.
Internal.
fmt :: FormatTime a => Text -> a -> TextSource
Formatter call. Probably don't want to use this.