Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Pascal
Expertise: Beginner
Jun 15, 1998

Computing Number of the Week

Question:
I want to compute the number of the week.

Thanks in advance

PLM

Answer:
This is pretty basic stuff. If you want the current week of the month, a simple function will do the trick:

function GetWeekOfMonth(Day : Integer) : Integer;
begin
  if (Day >= 1) AND (Day <= 7) then
    Result := 1;
  if (Day >= 8) AND (Day <= 14) then
    Result := 2;
  if (Day >= 15) AND (Day <= 21) then
    Result := 3;
  if (Day >= 22) AND (Day <= 28) then
    Result := 4;
  if (Day > 29) then
    Result := 5;
end;
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date