Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a Table of Dates

Status
Not open for further replies.

MLNorton

Programmer
Nov 15, 2009
134
US
I need to create a Table of the weeks and dates of the Mondays of a year. I select the first Monday of the year from a MonthCalendar.
The Table values are as follows:
Week integer (1, 2, 3..52)
DateName string (Jan 7, Jan 14, Jan 21..Dec 30)
WeekName string (1/7, 1/14. 1/21..12/30)

Can anyone help?
 
Try something like this:

Code:
var
  DateAux: TDate;
  DateEndYear: TDate;
  WeekNo: integer;
begin
  DateAux := MonthCalendar1.Date;
  DateEndYear := EndOfTheYear;
  WeekNo := 1;
  repeat 
      ShowMessage(IntToStr(WeekNo) + sLineBreak +
                  FormatDateTime('mmm d', DateAux) + sLineBreak +
                  FormatDateTime('m/d', DateAux));
      DateAux := DateAux + 7; 
      Inc(WeekNo);
  until DateAux > DateEndYear;

Hope this helps.

[URL unfurl="true"]http://www.imoveisemexposicao.com.br/imobiliarias-em-guarulhos[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top