> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# convertTimeFormat

> Use the convertTimeFormat task to convert a time value into a new moment.js format string.

The `convertTimeFormat` task converts a time value into a new format.

## Potential use case

Use this task if a workflow requires you to take a specific record timestamp and convert it to a different time or date format, such as the quarter of the year, or to provide only the day of the year from a given date.

## Properties

### Input variables

| Incoming          | Type   | Description                                                                                                                                                                                                                  | Example                                         |
| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| `inputTime`       | Object | Required. The timestamp to be converted, presented as a [moment.js](https://momentjs.com/docs/#/displaying/format/) formatted string. The timestamp must be provided as a value of the `time` key; see the provided example. | `{ "time": "2023-04-28T01:21:14.052000-1100" }` |
| `newFormatString` | String | Required. The [format](https://momentjs.com/docs/#/displaying/format/) of the converted timestamp.                                                                                                                           | `gg`                                            |

### Output variables

| Outgoing        | Type   | Description                                                                                     |
| --------------- | ------ | ----------------------------------------------------------------------------------------------- |
| `convertedTime` | Object | The converted time value, presented in the format specified by the `newFormatString` parameter. |

## Example 1

In this example:

* The `inputTime` property is provided by the output of `getTime`, a reference task located elsewhere in the workflow. The reference variable provided by the `getTime` task is `time`.
* The `newFormatString` property is set to `gg`, which is the moment.js [locale two-digit format](https://momentjs.com/docs/#/displaying/format/) for **Week Year** (1–52).
* The `convertedTime` will be the week number of the year in which the `inputTime` value exists.

![](/_fern-img/1f733bb7736d063a419c28e36853afd6fd64395cc6c7c3dcd761a23fea4cdeed.webp)

## Example 2

In this example:

* The `inputTime` property is provided by the output of `getTime`, a reference task located elsewhere in the workflow. The reference variable provided by the `getTime` task is `time`.
* The `newFormatString` property is set to `Qo`, which is the [moment.js format](https://momentjs.com/docs/#/displaying/format/) for **Quarter**. This format includes a trailing numeral abbreviation such as "1st", "2nd", "3rd", or "4th".
* The `convertedTime` will be the quarter number for the calendar year in which the `inputTime` value exists. If the `inputTime` value is February 12, the resulting `convertedTime` value will be "2nd" Quarter.

![](/_fern-img/74926b9824c73339f6b3489572daaed6ca1c4790a39e505c372dd33020a00be9.webp)

## Manual reference variable entry (inputTime)

To enter the `inputTime` object manually, use the format below for Year-Month-Date-Time (`yyyy-MM-dd 'T' HH:mm:ss.SSSZ`):

```json
{"time": "2021-02-26T15:00:00.000Z"}
```

This format displays as:

```
2021-02-25 03:00.00
```