project project2.exe raised exception class EConvertError with message
''2004-1-1 11:06:38' is not a valid time' process stopped. use step or run to continue.
  我是想获得一个时间差
     想把自己编的程序的两个变量获得的时间求差

解决方案 »

  1.   

    '2004-1-1 11:06:38'在你的程序中是不是字符串类型?
    用这个看看:StrToDateTime('2004-1-1 11:06:38')
      

  2.   

    formatdatetime('YYYY-HH-MM',now);
    试试
      

  3.   

    用体tickcounts()和获得很精确的时间
      

  4.   

    如果是系统内部时差都使用TDateTime类型即可,如果是string转换的时间亦可,不过string转换
    为TDateTime比较复杂,需要预定义时间格式
    var
    t1,t2: TDateTime;
    diff: integer;
    begin
      t1 := now;
      sleep(1000);
      t2 := now;
      diff := t2 - t1; //TDateTime的单位为天,如转换为秒则(t2-t1)*24*3600
      
    end;