# format_relative_timestamp

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/sessions/format_relative_timestamp)

Format ISO timestamp as relative time (e.g., '5m ago', '2h ago').

## Signature

```python
format_relative_timestamp(
    iso_timestamp: str | None,
) -> str
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `iso_timestamp` | `str \| None` | Yes | ISO 8601 timestamp string, or `None`. |

## Returns

`str`

Relative time string or empty string if invalid.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/a98f0dfa8d534d8a1885b524632400e52db22ac6/libs/code/deepagents_code/sessions.py#L195)