先转化为日期型,strtodate()??具体函数记不得了

解决方案 »

  1.   

    先strtodatatime(strtemp)+1 不就行了?
    把你的机器上日期格式设置成月/日/年就可以了.
      

  2.   

    function aa(a:string):tdatetime;//a:='4-19-2001 19:22:22'
    begin
    result:=strtodatetime('4-19-2001 19:22:22')+1;
    end;
      

  3.   

    你把 2001-4-19 拆成 2001, 4, 19 三个数,
    用函数 EncodeDate(2001, 4, 19) 重新生成
    日期,然后加1。
    具体情况可查看 EncodeDate 的帮助。
      

  4.   

    只有从控制面板里把日期格式改为mm-dd-yyyy了,再用strtodatetime('4-19-2001 19:22:22')+1就不会出错了。
      

  5.   

    用format函数先将字符格式化成delphi可识别的形式,在做计算
      

  6.   

    转换日期的代码
    function f(ClientStr: String): String;
    var
        pos1, pos2, i : integer;
    begin
        pos1 := 0;
        for i := 1 to Length(ClientStr) do
            if ClientStr[i] = '-' then
                if pos1 = 0 then pos1 := i
                else pos2 := i;
        Result := copy(ClientStr,pos2+1,4) + '-' +
                  copy(ClientStr,1,pos1-1)+ '-' + copy(ClientStr,pos1+1,pos2-pos1-1);
    end;
      

  7.   

    把客户端的日期格式设为YYYY-MM-DD的格式最好