mysql 查找时间戳
时间: 2023-08-27 07:15:07 浏览: 151
在MySQL中,如果要查询时间戳,可以使用FROM_UNIXTIME函数将时间戳转换为日期。以下是一个示例的SQL语句:
```
SELECT COUNT(*) AS user_regnumber, FROM_UNIXTIME(reg_time, "%Y-%m-%d") AS group_date
FROM users
WHERE status = 1
GROUP BY group_date;
```
这个语句的意思是根据注册时间格式化后的日期(group_date)进行分组查询,并且只查询status字段为1的用户。执行这条SQL语句后,可以打印结果进行查看。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [mysql根据时间戳查询数据](https://blog.csdn.net/qq_31648761/article/details/70237678)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [MySQL 时间戳类型](https://blog.csdn.net/dingyu002/article/details/117819666)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文