DATE_FORMAT('2002-08-26','%Y-%m-%d %H:%T%S')

解决方案 »

  1.   

    错了,重贴
    DATE_FORMAT('2002-08-26','%Y-%m-%d %H:%T:%S')
      

  2.   

    select date_format(pubdate,'%Y-%m-%d %H:%i:%s') as date from table
      

  3.   

    唉,其实DATE_FORMAT('2002-08-26','%Y-%m-%d %T')就可以了.
      

  4.   

    select count(*) from luntan where id!=0 and date_format(date,'%Y-%m-%d')>=2002-08-26 and date_format(date,'%Y-%m-%d')<=2002-08-27 order by date desc 这样写正确吗?我在mysql中运行,count(*)为0,而实际上我的数据库中有两条记录,为什么?请大侠指教!!!
      

  5.   

    select count(*) from luntan where id!=0 and date_format(date,'%Y-%m-%d')>='2002-08-26' and date_format(date,'%Y-%m-%d')<='2002-08-27' order by date desc
      

  6.   

    用以下这一句更好
    select count(*) from luntan where id!=0 and ( date_format(date,'%Y-%m-%d') between '2002-08-26' and '2002-08-27') order by date desc