在國外一般表示日期不是YYYY/MM/DD,而是習慣性的說第幾個禮拜幾。
比如:2004年1月5日,他們會說是2004年第二個禮拜的星期一。
現在請問那位能用DELPHI寫一個把YYYY/MM/DD轉換成YYYY/第幾個禮拜/星期幾,
的函數。

解决方案 »

  1.   

    两个函数就搞定了
    Returns the week of the year represented by a TDateTime value.Unit
    DateUtilsfunction WeekOfTheYear(const AValue: TDateTime): Word; overload;
    function WeekOfTheYear(const AValue: TDateTime; var AYear): Word; overload;
    ////////////////////////////////////////////////////////////
    Returns the day of the week represented by a TDateTime value.Unit
    DateUtilsfunction DayOfTheWeek(const AValue: TDateTime): Word;
      

  2.   

    WeekOf()  //求出第几个礼拜
    DayOfTheWeek()  //求出星期几
      

  3.   

    uses DateUtils
    procedure TForm1.Button1Click(Sender: TObject);
    var
      s: string;
    begin
      s := inttostr(WeekOftheyear(DateTimePicker1.Date));
      s := inttostr(yearof(DateTimePicker1.Date)) + '/第' + s + '个礼拜/星期' + inttostr(DayOfTheWeek(DateTimePicker1.Date));
      showmessage(s);
    end;