看一下:
 datetime := now ;
 showmessage(  formatdatetime('yyyy-mm-dd hh:mm:ss',datetime));
 showmessage(  formatdatetime('yyyy-mm-dd hh:mm:ss',datetime+2));

解决方案 »

  1.   

    DATETIME类型其实象实数类型,可以像实数那样操作,整数部分代表天数,小数部分*24(小时/天)代表小时。
    加上两天:dDate:=dDate+2;
    减去两天:dDate:=dDate-2;
      

  2.   

    Date functionReturns the current date.DateDelta constantSpecifies the correction factor when computing the difference between two date and time types that do not begin in the same year.DateTimeToFileDate functionConverts a TDateTime object to a DOS date-and-time value.DateTimeToStr functionConverts a TDateTime value to a string.DateTimeToString procedureConverts a TDateTime value to a string using a specified Format.DateTimeToSystemTime procedureConverts a TDateTime value into the Win32 API's TSystemTime type.DateTimeToTimeStamp functionConverts a TDateTime value into the corresponding TTimeStamp value.DateToStr functionConverts a TDateTime value to a string.DayOfWeek functionReturns the day of the week for a specified date.DecodeDate procedureReturns Year, Month, and Day values for a TDateTime value.DecodeTime procedureBreaks a TDateTime value into hours, minutes, seconds, and milliseconds.EncodeDate functionReturns a TDateTime value that represents a specified Year, Month, and Day.EncodeTime functionReturns a TDateTime value for a specified Hour, Min, Sec, and MSec.FormatDateTime functionFormats a TDateTime value.IncMonth functionReturns a date shifted by a specified number of months.IsLeapYear functionIndicates whether a specified year is a leap year.MSecsPerDay constantSpecifies the number of milliseconds per day.MSecsToTimeStamp functionConverts a specified number of milliseconds into a TTimeStamp value.Now functionReturns the current date and time.ReplaceDate procedureReplaces the date portion of a TDateTime value with a specified date.ReplaceTime procedureReplaces the time portion of a TDateTime value with a specified time.SecsPerDay constantIndicates the number of seconds per day.StrToDate functionConverts a string to a TDateTime value.StrToDateTime functionConverts a string to a TDateTime value.StrToTime functionConverts a string to a TDateTime value.SystemTimeToDateTime functionConverts a TSystemTime value into a TDateTime value.Time functionReturns the current time.TimeStampToDateTime functionConverts a TTimeStamp value into the corresponding TDateTime value.TimeStampToMSecs functionConverts a TTimeStamp value into an absolute number of milliseconds.TimeToStr functionReturns a string that represents a TDateTime value.
      

  3.   

    同意  xxmmmx(踢踏)
    DATETIME类型其实象实数类型,可以像实数那样操作,整数部分代表天数,小数部分*24(小时/天)代表小时。
    加上两天:dDate:=dDate+2;
    减去两天:dDate:=dDate-2;
      

  4.   

    只要你看一下系统关于TDate的定义就什么都明白了