Week function needed 
Author Message
 Week function needed

Hi,

I need a function which returns the number of the week using a year as input
parameter. I would be very grateful if somebody
could help me. Thanks in advance.

Fernando Naranjo.



Wed, 18 Jun 1902 08:00:00 GMT  
 Week function needed
search for freeware HYPERSTRING. I've forgot its link


Quote:
> Hi,

> I need a function which returns the number of the week using a year as
input
> parameter. I would be very grateful if somebody
> could help me. Thanks in advance.

> Fernando Naranjo.



Wed, 18 Jun 1902 08:00:00 GMT  
 Week function needed
Our Calendar Component finds the week number.
See http://www.orbital.co.za/text/compcal.htm

On Wed, 18 Oct 2000 15:44:23 +0800, "Madhillah Mohammad"

Quote:

>search for freeware HYPERSTRING. I've forgot its link



>> Hi,

>> I need a function which returns the number of the week using a year as
>input
>> parameter. I would be very grateful if somebody
>> could help me. Thanks in advance.

>> Fernando Naranjo.


Orbital Decisions  Visual Planning Systems
Orbital URL: http://www.orbital.co.za/contents.htm
Components/Apps (70% discount): http://www.orbital.co.za/orbcomp.htm
User Group URL: http://www.orbital.co.za/delphi.htm
David URL: http://www.orbital.co.za/cv.htm
HASM URL: http://www.orbital.co.za/hasm.htm


Wed, 18 Jun 1902 08:00:00 GMT  
 Week function needed
Just use:

var
  FirstWeekDay: Integer = 2; { first day of week
    2 : monday (DIN 1355) }
  FirstWeekDate: Integer = 4; { date in first week
    1 : year starts on Jan 1st
    4 : first "4-day-week" (DIN 1355)
    7 : first complete week }

{ Returns date of first day of week }
function WeekToDate(AWeek, AYear: Integer): TDateTime;
begin
  Result := EncodeDate(AYear, 1, FirstWeekDate);
  Result := Result + (AWeek - 1) * 7 - ((DayOfWeek(Result) + (7 -
FirstWeekDay)) mod 7);
end;

{ Returns no. of week and year the week belongs to }
procedure DateToWeek(ADate: TDateTime; var AWeek, AYear: Integer);
var
  Month, Day: Word;
begin
  ADate := ADate - ((DayOfWeek(ADate) - FirstWeekDay + 7) mod 7) + 7 -
FirstWeekDate;
  DecodeDate(ADate, AYear, Month, Day);
  AWeek := (Trunc(ADate - EncodeDate(AYear, 1, 1)) div 7) + 1;
end;



Quote:
> search for freeware HYPERSTRING. I've forgot its link



> > Hi,

> > I need a function which returns the number of the week using a year as
> input
> > parameter. I would be very grateful if somebody
> > could help me. Thanks in advance.

> > Fernando Naranjo.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Day Of Week function

2. NEED ALGORITHM TO CALANDAR PRGM TO GIVE WEEK

3. Day in week and week in year calculations, oops!

4. Search function need help

5. Number to Speech Function needed

6. Need arccosinus function

7. need help with recursive function

8. Need help with DbiPutField and similiar functions.

9. Need help in function and array!

10. Need help porting function to Free Pascal

11. Need help porting function to Free Pascal

12. Needs help on MsGraph's functions.

 

 
Powered by phpBB® Forum Software