2

我尝试了很多例子,但没有人能解决我的问题。以下是我尝试过的一些示例。只是我需要将字符串日期更新为可为空的日期时间列。我得到的是 000-00-00 或 NULL 列。

感谢您的帮助我是 mysql 的新手,试图理解:/

Update `scorelisting` 
set MaxScoreDate=DATE(STR_TO_DATE('13.05.2012 15:31:00','%d.%m.%Y %H:%M:%S')) 
where UserId=258070

Update `scorelisting` 
set MaxScoreDate=STR_TO_DATE('13.05.2012 15:31:00','%d.%m.%Y %H:%M:%S') 
where UserId=258070

Update `scorelisting` 
set MaxScoreDate=DATE('%d.%m.%Y %H:%M:%S',STR_TO_DATE('13.05.2012 15:31:00')) 
where UserId=258070

Update `scorelisting` 
set MaxScoreDate=DATE('%d.%m.%Y %H:%M:%S',strtotime('13.05.2012 15:31:00'))
where UserId=258070
4

1 回答 1

2

使用分钟i_

Update `scorelisting` 
set MaxScoreDate=DATE(STR_TO_DATE('13.05.2012 15:31:00','%d.%m.%Y %H:%i:%s')) 
where UserId=258070
于 2012-11-19T09:29:32.520 回答