TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
 Specialized Dev Zones Research Center eBook Library .NET Java C++ Web Dev Architecture Database Security Open Source Enterprise Mobile Special Reports 10-Minute Solutions DevXtra Blogs Slideshow

Language: Pascal
Expertise: Beginner
Jun 15, 1998

### WEBINAR:On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning

# Computing Number of the Week

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

PLM

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

 Submit a Tip Browse "Delphi And Pascal" Tips Browse All Tips
Comment and Contribute

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

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