如何单独取得TDateTimePicker控件的年度和月份

解决方案 »

  1.   

    formatedatetime通过日期格式来得到
      

  2.   

    DecodeDate procedureSee also Example--------------------------------------------------------------------------
    Returns Year, Month, and Day values for a TDateTime value.UnitSysUtilsCategorydate/time routinesprocedure DecodeDate(Date: TDateTime; var Year, Month, Day: Word);DescriptionThe DecodeDate procedure breaks the value specified as the Date parameter into Year, Month, and Day values. If the given TDateTime value has a negative (BC) year, the year, month, and day return parameters are all set to zero.
      

  3.   

    var year, month, day: Word;
    DecodeDate(DateTimePicker1.Date, year, month, day);或FormatDateTime('yyyy', DateTimePicker1.Date);
    FormatDateTime('mm', DateTimePicker1.Date);