如何把字符类型的数据转换为日期型的?
如0001转换为00:01

解决方案 »

  1.   

    对啊 对啊
    怎么做啊 我用的oracle
      

  2.   

    function StrToDate(const S: string): TDateTime;
    function FormatDateTime(const Format: string; DateTime: TDateTime): string;
      

  3.   

    function GetDataTime(S:string):TDataTime;
    var
      mm,ss:integer;
    begin
      mm:=StrToInt(copy(s,1,2));
      ss:=StrToInt(copy(s,3,2));
      Result:=EncodeTime(0,mm,ss,0);
    end;
      

  4.   

    转换字串应该是'00:01'这种形式吧!
    转换函数是:StrToTime('00:01')显示为字串:
    Edit1.Text:=FormatDatetTime('hh:mm',StrToTime('00:01'));
      

  5.   

    呵呵..
       我楼上的说得不错...
    不过楼主要得是这种结果(小时和分钟)
    故要改为:var s:string;
        hh,mm:integer;
    begin
      s:='0001';
      hh:=StrToInt(copy(s,1,2));
      mm:=StrToInt(copy(s,3,2));
      edit1.Text:=formatdatetime('hh:mm',EncodeTime(hh,mm,0,0));
    end;
      

  6.   

    我同志shidongdong(东东)的意见。