strdate:=formatdatetime('yyyy-mm-dd',now); 
  strtime:=formatdatetime('hh:ss:mm',now);
日期查询把日期COPY出来,然后用<>或者BETWEEN AND啊

解决方案 »

  1.   

    var
      dDate: TDate;
    begin
      dDate := StrToDate('2002-09-05');
    end;
    如果是这样当然会出错了:
    dDate := StrToDate('20020905');
      

  2.   

    与系统区域选项中的日期格式设置有关。
    可能是yyyy-mm-dd
      

  3.   

    你在使用strtodate或strtodatetime这两个函数时应该了解系统的日期分隔符是怎样的,分隔符在缺省情况下是'/',但中国的习惯是'-'.这要视你的系统设置面定在程序中如何避免这种情况呢.使用DateSeparator吧,将其赋值为你想要的分隔符即可.例:
      DateSeparator := '-';
      strdate := strtodate('2002-1-1');
      

  4.   

    使用EncodeDate( Year, Month, Day )就不存在日期格式问题了!!!
      

  5.   

    能说得详细一点吗?比如说我的一个string  '8/30/1999',怎么转换,我没怎么用过delphi
      

  6.   

    同意!
    日期的格式要用yyyy-mm-dd
      

  7.   

    yuanscar(塑料树) 
    string '8/30/1999'应如下转换:DateSeparator := '-';
    ShortDateFormat := 'm/d/yyyy';
    ddate := strtodate('8/30/1999');