在DELPHI里面有时间类型的变量吗?
还有有没有一个函数能得到当前的
时间?
还有在得到时间后把时间转换成字符串
类型的函数是什么?

解决方案 »

  1.   

    now
    FormatDateTime('yyyymmdd', now)
      

  2.   

    Now
    Date(Now)
    Time(Now)
    DateToStr(MyDate)
    TimeToStr(MyTime)
      

  3.   

    要得到小时、分、秒   只需:
    NowStr:=FormatDateTime('hh:mm:ss',now);
    时间转换成字符串:
    DateTimeToStr(  )
      

  4.   

    TDateTime;
    now();
    DateToStr(datetime);
    DatetimeToStr(datetime);FormatDataTime(const Format: String;datetime:Tdatatime):String;etc.
    你可以察看帮助!
      

  5.   

    Date(Now)
    Time(Now)
    DateToStr(MyDate)
    TimeToStr(MyTime)
      

  6.   

    你可以用 Tdate 定义一个时间变量
    Date1:Tdate;
    datestr:string;
    date1=date(now);
    datestr:=datetostr(date1);
      

  7.   

    now , today 
    DateToStr(datetime)
    DatetimeToStr(datetime)
      

  8.   

    var
      Present: TDateTime;
      Year, Month, Day, Hour, Min, Sec, MSec: Word;
     begin
      Present:= Now;
      DecodeDate(Present, Year, Month, Day);
      Label1.Caption := 'Today is Day ' + IntToStr(Day) + ' of Month '
        + IntToStr(Month) + ' of Year ' + IntToStr(Year);
      DecodeTime(Present, Hour, Min, Sec, MSec);
      Label2.Caption := 'The time is Minute ' + IntToStr(Min) + ' of Hour '
        + IntToStr(Hour);
    end;