1106540256 请把他转换成日期,在线等待

解决方案 »

  1.   

    ShowMessage(DateToStr(1106540256));
    结果同楼上
      

  2.   

    我现在从数据库中取字段PTIME。他转换成日期后获取文件名
    C的程序如下
    AnsiString strSecond,strMinute,strHour,strDay,strMonth,strYeartime_t timer;
    struct tm *ptimer;
    timer=ptime;//长整数
    ptimer=localtime(&timer);
    strSecond=IntToStr(ptimer->tm_sec);
    strMinute=IntToStr(ptimer->tm_min);
    strHour=IntToStr(ptimer->tm_hour);
    strDay=IntToStr(ptimer->tm_mday);
    strMonth=IntToStr(ptimer->tm_mon+1);
    strYear=IntToStr(1900+ptimer->tm_year);
    我在DELPHI转换不了
    我写几个数据放上面
    1107251956 :对应时间为20050201175916
    1107252100 :对应时间为20050201180140
    希望大家帮帮我
      

  3.   

    这个是unix的时间和windows时间的转换问题...我记得一本书上是有转换的算法.可惜书不在身边.找到一个函数,你自己看吧.我测试了一下,问题不是很大.
    另外,是你问的不清楚...不是我们回答的问题.OK.Function TForm1.UTimeToWTime(UTime:integer):TdateTime;
    var
      tmpDT:Tdatetime;
      str1,str2:string;
    begin
      str1:=datetostr(EncodeDate(1970,1,1));
      str2:=timetostr(EncodeTime(0,0,0,0));
      tmpDT := strtodatetime(str1+' '+str2);  result :=Round(UTime /86400) + tmpDT ;
    end;
      

  4.   

    function DatetimeToCTime(t:TDatetime):Longint;
    begin
      result := ceil(946656000+(t-36526)*24*3600);
    end;function CTimeToDateTime(t:LongInt):TDateTime;
    begin
        Result:=(t-946656000)/24/3600+36526;
    end;
      

  5.   

    delphi中tdatetime就是double,是距1899-12-30 12:00 的天数。
    而C中time_t是longint,是距1970-1-1 8:00的秒数。
      

  6.   

    Function TForm1.UTimeToWTime(UTime:integer):TdateTime;
    var
      tmpDT:Tdatetime;
      str1,str2:string;
    begin
      str1:=datetostr(EncodeDate(1970,1,1));
      str2:=timetostr(EncodeTime(0,0,0,0));
      tmpDT := strtodatetime(str1+' '+str2);  result :=UTime /86400 + tmpDT ;
    end;这样就可以了....
      

  7.   

    我的解决方法
    procedure TForm1.Button1Click(Sender: TObject);
    var
      x :tdatetime;
    begin  x :=incSecond(strtodatetime('1970-01-01 08:00:00'), strtoint(edit2.Text ) );
      edit1.Text :=datetimetostr(x);
    end;