FormatDatetime('yyyy-mm-dd hh:nn:ss', Date);

解决方案 »

  1.   

    var
      b : Double;
    begin
      b := Int(Now);
      showmessage(FormatDatetime('yyyy-mm-dd hh:nn:ss', TDateTime(b))); 
    end;
      

  2.   

    decodetime 和 decodedate 两个函数。
    例子
    procedure TForm1.Button1Click(Sender: TObject);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;
      

  3.   

    StrToDateTime(DateToStr(now)+' '+'00:00:00');
    Label1.Caption:=DateToStr(now)+' '+'00:00:00');
      

  4.   

    FormatDateTimeToStr('yy-mm-dd hh:mm:ss',now);
      

  5.   

    formatdatetime('yyyy-MM-dd 00:00:00',now)