> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arouter.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 日期时间工具

> 将当前日期和时间注入模型上下文。datetime Server Tool 让模型获得准确的时间感知，无需系统提示 hack。

`datetime` Server Tool 为模型提供当前的日期和时间。

## 快速开始

```json theme={null}
{
  "model": "openai/gpt-5.4",
  "messages": [{"role": "user", "content": "What day of the week is today, and how many days until the end of the year?"}],
  "tools": [{"type": "arouter", "arouter": {"id": "datetime"}}]
}
```

## 配置

| 参数         | 类型       | 默认值     | 描述                                                                      |
| ---------- | -------- | ------- | ----------------------------------------------------------------------- |
| `id`       | `string` | —       | 必须为 `"datetime"`                                                        |
| `timezone` | `string` | `"UTC"` | IANA 时区标识符（例如 `"America/New_York"`、`"Asia/Shanghai"`、`"Europe/London"`） |

## 工具响应格式

```json theme={null}
{
  "datetime": "2026-04-03T14:32:00Z",
  "date": "2026-04-03",
  "time": "14:32:00",
  "timezone": "UTC",
  "day_of_week": "Friday",
  "unix_timestamp": 1775319120
}
```

## 使用场景

**日程安排和规划：**

```python theme={null}
response = client.chat.completions.create(
    model="openai/gpt-5.4",
    messages=[{"role": "user", "content": "Create a 2-week project plan starting from today."}],
    tools=[{"type": "arouter", "arouter": {"id": "datetime", "timezone": "Asia/Shanghai"}}],
)
```

## 定价

`datetime` 工具是**免费**的——除正常 LLM Token 费用外不收取额外费用。

## 下一步

* [网页搜索工具](/zh/guides/features/server-tools/web-search)
* [Server Tools 概览](/zh/guides/features/server-tools/overview)
