取得日期,怎么得到该日期是这年的第几个日期?

解决方案 »

  1.   

    function GetDays(ADate: TDate): Extended; 
    varFirstOfYear: TDateTime;beginFirstOfYear := EncodeDate(StrToInt(FormatDateTime('yyyy', now)) - 1, 12, 31);Result := ADate - FirstOfYear;end;procedure TForm1.Button1Click(Sender: TObject);beginlabel1.Caption := 'Today is the ' + FloatToStr(GetDays(Date)) + '. day of the year';end; 
      

  2.   

    uses DateUtils
    function DayOfTheYear(const AValue: TDateTime): Word;