# FORMAT\_TIME

**The FORMAT\_TIME function converts a** [**Time**](../../variable-data-types/the-time-variable-data-type) **into a** [**String**](../../variable-data-types/the-text-variable-data-type) **with two optional parameters, a configurable format, and a locale.**

This function interprets its parameters the same as the [FORMAT\_DATETIME](format_datetime) does, see that article for more details.

#### Declaration

```javascript
FORMAT_TIME(time, format_string, locale) -> formatted_time_string
```

#### Parameters

**time** (type: _time_) Any time

**format\_string** (optional, type: _string_, default: [ISO 8601 Format](https://en.wikipedia.org/wiki/ISO_8601), **"YYYY-MM-DDThh:mm:ssZ**") string representing the format to be outputted. The Date units available in the format can be found in [Data and Time Formatting Options](https://github.com/airkit/airkit-docs/blob/master/docs/v18-2/date-and-time-formatting-options.md).

**locale** (optional, type: _string,_ default\*:\* The user's current locale) The locale the time should be formatted in. This will configure which language formats containing month, and weekday names. Locale must match a valid [LCID String](https://www.science.co.il/language/Locale-codes.php).

#### Return Values

**formatted\_time\_string** (type: _string_) The formatted Time.

#### Examples

For the following examples assume we have a variable named **example\_time** that holds a Time that would format to the string  **"9:41 am"**.

```javascript
FORMAT_TIME(  
  example_time,   
  "h:mm a"
) -> "9:41am"
```

As with FORMAT\_DATETIME, when called with no format string, FORMAT\_TIME will generate an ISO 8601 and RFC3339 compatible timestamp. The date portion of the timestamp will default to January 1st, 1970.

```javascript
FORMAT_TIME(example_time) -> "1970-01-01T09:41:00Z"
```

#### Discussion

The [TIME\_FROM\_FORMAT](time_from_format) function is the opposite of FORMAT\_DATETIME. Rather than converting a DateTime to a String, it converts a String into a DateTime by parsing with a given format string.
