# Parse Relative Time

> Parse a user-provided relative time string into a Unix timestamp.

- ID: `parse_relative_time`
- Type: Block
- Category: [Time](https://inventor.bot/docs/reference/blocks/time.md)

> Duration is a sequence of numbers with unit suffix (s, m, h, d, w, mo, y). Examples: "30m" or "2h45m".

**Inputs**

| Name | Required | Description | Value |
| --- | --- | --- | --- |
| `duration` | yes | Relative time (3h, 42d, 1w, etc). | e.g. `"2h30m"` |

**Outputs**

| Name | Description | Value |
| --- | --- | --- |
| `valid_time` | Whether the duration could be parsed. | e.g. `"true"` |
| `parsed_real_time_unix` | Unix time after applying the duration to now. | e.g. `"1700003600"` |
| `parsed_time_seconds` | Duration in seconds. | e.g. `"9000"` |
| `parsed_time_minutes` | Duration in minutes. | e.g. `"150"` |
| `parsed_time_hours` | Duration in hours. | e.g. `"2"` |
| `parsed_time_days` | Duration in days. | e.g. `"0"` |

**Example**

```go
parseRelativeTime := parse_relative_time(Args{duration: "2h30m"})
send_text_message(Args{
	channel_id:      trigger.channel_id,
	message_content: "Valid Time: " + parseRelativeTime.valid_time,
})
```