INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Business Objects: Crystal Reports 1 Formulas FAQ

## Formula Help

 Calculate Weeknumber - (ISO 8601) Weeks start on monday and week 1 is the one including January 4th by poujor faq767-4940 Posted: 14 Mar 04 (Edited 28 Oct 14) The DatePart does not calculate weeknumbers correctly in some cases. The formula DatePart('ww',cdate(2005,1,1),2,2) ought to return 53 - it returns 9363!! local dateTimeVar InputDate:=DateToComputeWeekNumberOn; local numbervar A; local numbervar B; local datevar C; local numbervar D; A := Weekday(InputDate); B := Year(InputDate + ((8 - A) Mod 7) - 3); C := cdate(B, 1, 1); D := (Weekday(C) + 1) Mod 7 - 3; (InputDate - C + D) \ 7 + 1 Below is the formula with comments: local dateTimeVar InputDate:=DateToComputeWeekNumberOn; local numbervar A; local numbervar B; local datevar C; local numbervar D; A := Weekday(InputDate); //Day of week - 1 is sunday, 2 is monday ... 7 is saturday B := Year(InputDate + ((8 - A) Mod 7) - 3); //Calculate thursday of current week, return year of this thursday C := cdate(B, 1, 1);//January 1st D := (Weekday(C) + 1) Mod 7 - 3;);//Offset to monday in week 1st (InputDate - C + D) \ 7 + 1 //The Parens is days between monday of week 1 and inputdate Back to Business Objects: Crystal Reports 1 Formulas FAQ Index Back to Business Objects: Crystal Reports 1 Formulas Forum

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!