Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在mysql中使用时间戳进行搜索_Sql_Mysql - Fatal编程技术网

无法在mysql中使用时间戳进行搜索

无法在mysql中使用时间戳进行搜索,sql,mysql,Sql,Mysql,我在mysql中创建了一个时间戳字段,其中日期存储为06/01/2010 07:55:40 现在,如果我尝试使用以下查询搜索任何内容: select StartTime from results where timestamp(StartTime) = "30/09/2009" 它不起作用 即使我也不能用这个: select * from results where StartTime between "06/01/2010 07:55:40" and "01/02/20

我在mysql中创建了一个时间戳字段,其中日期存储为
06/01/2010 07:55:40

现在,如果我尝试使用以下查询搜索任何内容:

select StartTime 
  from results 
 where timestamp(StartTime) = "30/09/2009"
它不起作用

即使我也不能用这个:

select * 
  from results 
  where StartTime between "06/01/2010 07:55:40" and "01/02/2010 07:55:40"
如果我使用:

select  timestamp(current_date());
…然后显示
02/03/2010 00:00:00

我应该把格式改成00-00-0000吗?或者我可以使用当前表中的相同格式进行搜索吗

有人能提出建议吗?

使用显式格式:

SELECT  *
FROM    results
WHERE   starttime = TIMESTAMP(STR_TO_DATE('02/03/2010 21:30:00', '%d/%m/%Y %H:%i:%s'));

不是每次都使用这个,在数据库中转换时间戳是否容易?