TTime中的数字也可以有整数以上的部分来代表天数,那它和TDateTime不就一点区别也没有了么?那么在使用上有什么不同?例如在数据库中值转换的AsTime和AsDateTime等等这些都有区别么?现在我在程序里一会用这个一会用那个,会不会有不良的后果阿?

解决方案 »

  1.   

    VCL Reference
    Time property (TDateTimePicker)TDateTimePicker See alsoIndicates the time entered by the user.Delphi syntax:type TTime = type TDateTime;
    property Time: TTime;C++ syntax:typedef System::TDateTime TTime;
    __property Controls::TTime Time = {read=GetTime, write=SetTime};DescriptionTime represents the time entered by the user. Set Time in program code or in the Object Inspector to determine which time is selected by default. (Applies only when Kind = dtkTime.)
      

  2.   

    为了便于阅读分两次回帖
    TDateTime
     Delphi Object and Component Reference
      TDateTime typeSee alsoTDateTime represents a date-and-time value in the Delphi language.UnitSystemDelphi syntax:type TDateTime = type Double;DescriptionMost CLX objects represent date and time values using a TDateTime value. In Delphi, TDateTime is a type that maps to a Double. In C++, the TDateTime class corresponds to the Delphi TDateTime type. The integral part of a Delphi TDateTime value is the number of days that have passed since 12/30/1899. The fractional part of the TDateTime value is fraction of a 24 hour day that has elapsed. Following are some examples of TDateTime values and their corresponding dates and times:0 12/30/1899 12:00 am
    2.75 1/1/1900 6:00 pm
    -1.25 12/29/1899 6:00 am
    35065 1/1/1996 12:00 am
    To find the fractional number of days between two dates, simply subtract the two values, unless one of the TDateTime values is negative. Similarly, to increment a date and time value by a certain fractional number of days, add the fractional number to the date and time value if the TDateTime value is positive. 
    When working with negative TDateTime values, computations must handle time portion separately. The fractional part reflects the fraction of a 24-hour day without regard to the sign of the TDateTime value. For example, 6:00 am on 12/29/1899 is ?.25, not ? + 0.25, which would be ?.75. There are no TDateTime values between ? and 0.Note: Delphi 1.0 calculated the date from year 1 instead of from 1899. To convert a Delphi 1.0 date to a TDateTime value in later versions of the Delphi language, subtract 693594.0 from the Delphi 1.0 date.
      

  3.   

    谢谢
    TTime和TDateTime都被定义成Double对吧?我想知道,如果TTime没有任何约束,和TDateTime各个方面都一样,那TTime还有什么存在的意义呢??
    谢谢
      

  4.   

    cardinal 和 THandle 和 DWORD 都一样,哪个没有存在的必要了,你说?