gpt4 book ai didi

php - SQL 中 strtotime 相当于什么?

转载 作者:行者123 更新时间:2023-11-29 07:07:04 27 4
gpt4 key购买 nike

我的第一个表格中有一个采用这种格式的日期 2016-12-20我需要将其与第二个表中采用这种格式的另一个日期进行比较

 2016-12-21 18:40:22

在 php 中,我可以使用

更改此格式

$date = date("Y-m-d", strtotime($date));

SQL中的strtotime相当于什么,或者我如何比较mysql中不同格式的2个日期?

我读了 this question 并尝试了这个

select STR_TO_DATE(date, '%y-%m-%d') from second_table;

但它返回 NULL

最佳答案

Date and Time Functions

您可能需要使用date_format()

关于php - SQL 中 strtotime 相当于什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41269179/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com