# 标签的时间戳

**URL:** <https://meta.discourse.org/t/timestamp-of-tag/158598>\
**Category:** Support\
**Created:** [2020年七月23日 09:03 UTC](https://meta.discourse.org/t/timestamp-of-tag/158598 "2020-07-23T09:03:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Minhaj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/minhaj/32/137595_2.png) [@Minhaj](https://meta.discourse.org/u/Minhaj)\
**Post date:** [2020年七月23日 09:03 UTC](https://meta.discourse.org/t/timestamp-of-tag/158598/1 "2020-07-23T09:03:57Z")

</div>

我们可以查询将 `tag` 附加到主题的时间戳吗？例如，我想根据主题被标记某个标签的时间对主题进行排序。

---

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [2020年七月23日 16:37 UTC](https://meta.discourse.org/t/timestamp-of-tag/158598/2 "2020-07-23T16:37:56Z")

</div>

> [@Minhaj](#):
>
> 我们能否查询将 `tag` 附加到主题的时间戳？

使用 [Data Explorer](https://meta.discourse.org/t/data-explorer-plugin/32566) 插件应该可以获取此信息。标签添加到主题的时间可以从 `topic_tags` 表的 `created_at` 字段中找到。您需要连接 `tags` 表才能通过 `name` 查找标签。

---

<div class="post-metadata">

**Author:** ![Minhaj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/minhaj/32/137595_2.png) [@Minhaj](https://meta.discourse.org/u/Minhaj)\
**Post date:** [2020年七月24日 05:29 UTC](https://meta.discourse.org/t/timestamp-of-tag/158598/3 "2020-07-24T05:29:31Z")

</div>

感谢推荐插件，但我需要从 API 获取信息。  
当我向 `discourseURL/t/{tid}.json` 发送 `GET` 请求查询任何主题信息时，我没有在 `tags` 中看到 `created_at` 字段。您能建议我可能哪里出错了吗？

---

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [2020年七月24日 17:40 UTC](https://meta.discourse.org/t/timestamp-of-tag/158598/4 "2020-07-24T17:40:01Z")

</div>

> [@Minhaj](#):
>
> 我需要从 API 获取信息。

我认为 Discourse JSON 负载中没有任何地方提供标签的 `created_at` 参数。你可以编写一个 [Data Explorer](https://meta.discourse.org/t/32566?silent=true) 查询来获取标签的 `created_at` 值，然后通过 API 运行该查询。有关如何操作的详细信息，请参见此处：[如何使用 Discourse API 运行 Data Explorer 查询](https://meta.discourse.org/t/how-to-run-data-explorer-queries-with-the-discourse-api/120063)。
