# format · Rell standard library · Chromia Docs (concept)

> type format A time formatter type for formatting and parsing UTC dates and times. A rell.time.format value is
constructed from format pattern text. The res

Source: https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/rell.time/format/

TYPE

# format

```signature
type format
```

A time formatter type for formatting and parsing UTC dates and times. A `rell.time.format` value is
constructed from format pattern text. The resulting value can then be used to format a unix
timestamp according to the format pattern text, or the inverse, i.e. to parse a timestamp from text
that is formatted according to the format pattern text, returning a unix timestamp.

The following format specifiers are supported:

| Specifier | Meaning |
| --- | --- |
| `y` | Year |
| `M` | Month in the year |
| `w` | Week in the year |
| `W` | Week in the month |
| `D` | Day in the year |
| `d` | Day in the month |
| `E` | Day name in the week |
| `u` | Day number in the week |
| `a` | AM/PM specifier |
| `H` | Hour in the day (0-23) |
| `h` | Hour in the am/pm (1-12) |
| `m` | Minute in the hour |
| `s` | Second in the minute |
| `S` | Milliseconds in the second |

Non-interpreted text may be included within `'single quotes'`. A single quote is escaped with
a second single quote (i.e. `''`).

Examples:

Rell

```
rell.time.format('yyyy.MM.dd \'at\' HH:mm:ss').text_to_ms('2001.07.04 at 11:08:56') // returns 994244936000
rell.time.format('EEE, MMM d, \'\'yy').text_to_ms('Wed, Jul 4, \'01') // returns 994204800000
rell.time.format('h:mm a').text_to_ms('11:08 AM') // returns 40080000
rell.time.format('hh \'o\'\'clock\' a').text_to_ms('11 o\'clock AM') // returns 39600000
val ms: integer = 994244936235;
rell.time.format('hh:mm a').ms_to_text(ms) // returns '11:08 AM'
rell.time.format('yyyyy.MMMMM.dd hh:mm aaa').ms_to_text(ms) // returns '02001.July.04 11:08 AM'
rell.time.format('yyyy-MM-dd\'T\'HH:mm:ss.SSS').ms_to_text(ms) // returns '2001-07-04T11:08:56.235'
rell.time.format('yyyy-\'W\'ww-u').ms_to_text(ms) // returns '2001-W27-3'
```

Since 0.14.14

## Methods

[format](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/rell.time/format/format/)

[ms\_to\_text](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/rell.time/format/ms_to_text/)
:   Format a unix timestamp according to this time format value.

[text\_to\_ms](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/rell.time/format/text_to_ms/)
:   Parse a unix timestamp from text formatted according to this time format value.

[text\_to\_ms\_or\_null](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/rell.time/format/text_to_ms_or_null/)
:   Parse a unix timestamp from text formatted according to this time format value.

[to\_text](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/rell.time/format/to_text/)
:   Get the format text of this time format value.

[View this page on docs.chromia.com](https://docs.chromia.com/pages/rell-stdlib/-rell%20-system%20-library/rell.time/format/index.html)Generated API reference, mirrored from the live docs
