From 97f645c0ef17101440b8a8dbcfffcdeef82b9396 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Tue, 11 Feb 2025 01:47:34 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=92=ACGenerate=20LLM=20translations?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../05-datetime-functions/index.md | 6 ++--
.../05-datetime-functions/timestamp-diff.md | 33 +++++++++++++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
create mode 100644 docs/cn/sql-reference/20-sql-functions/05-datetime-functions/timestamp-diff.md
diff --git a/docs/cn/sql-reference/20-sql-functions/05-datetime-functions/index.md b/docs/cn/sql-reference/20-sql-functions/05-datetime-functions/index.md
index dabfa8aaed..6d248f4a72 100644
--- a/docs/cn/sql-reference/20-sql-functions/05-datetime-functions/index.md
+++ b/docs/cn/sql-reference/20-sql-functions/05-datetime-functions/index.md
@@ -2,7 +2,7 @@
title: 日期与时间函数
---
-本节提供 Databend 中与日期时间相关的函数的参考信息。
+本节提供了 Databend 中与日期时间相关的函数的参考信息。
## 转换函数
@@ -57,6 +57,7 @@ title: 日期与时间函数
- [LAST_DAY](last-day.md)
- [NEXT_DAY](next-day.md)
- [PREVIOUS_DAY](previous-day.md)
+- [TIMESTAMP_DIFF](timestamp-diff.md)
## 日期信息函数
@@ -72,4 +73,5 @@ title: 日期与时间函数
- [EXTRACT](extract.md)
- [TIME_SLOT](time-slot)
- [TIMEZONE](timezone.md)
-- [YESTERDAY](yesterday.md)
\ No newline at end of file
+- [YESTERDAY](yesterday.md)
+{/*examples*/}
\ No newline at end of file
diff --git a/docs/cn/sql-reference/20-sql-functions/05-datetime-functions/timestamp-diff.md b/docs/cn/sql-reference/20-sql-functions/05-datetime-functions/timestamp-diff.md
new file mode 100644
index 0000000000..e802469cc0
--- /dev/null
+++ b/docs/cn/sql-reference/20-sql-functions/05-datetime-functions/timestamp-diff.md
@@ -0,0 +1,33 @@
+---
+title: TIMESTAMP_DIFF
+---
+
+import FunctionDescription from '@site/src/components/FunctionDescription';
+
+
+
+计算两个时间戳之间的差异,并以 INTERVAL 形式返回结果。
+
+## 语法
+
+```sql
+TIMESTAMP_DIFF(, )
+```
+
+## 返回类型
+
+INTERVAL(格式为 `小时:分钟:秒`)。
+
+## 示例
+
+此示例展示了 2025 年 2 月 1 日与 2025 年 1 月 1 日之间的时间差为 744 小时,对应 31 天:
+
+```sql
+SELECT TIMESTAMP_DIFF('2025-02-01'::TIMESTAMP, '2025-01-01'::TIMESTAMP);
+
+┌──────────────────────────────────────────────────────────────────┐
+│ timestamp_diff('2025-02-01'::TIMESTAMP, '2025-01-01'::TIMESTAMP) │
+├──────────────────────────────────────────────────────────────────┤
+│ 744:00:00 │
+└──────────────────────────────────────────────────────────────────┘
+```
\ No newline at end of file