INTELLIGENT WORK FORUMS FOR COMPUTER PROFESSIONALS
Come Join Us!
Are you a Computer / IT professional? Join Tek-Tips now!
- Talk With Other Members
- Be Notified Of Responses
To Your Posts
- Keyword Search
- One-Click Access To Your
Favorite Forums
- Automated Signatures
On Your Posts
- 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.
Partner With Us!
"Best Of Breed" Forums Add Stickiness To Your Site

(Download This Button Today!)
Feedback
"...I have never been to any technical site that shows concern just to anybody with problems...I look forward to also share in the future..."
Geography
Where in the world do Tek-Tips members come from?
|
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
Posted: 14 Mar 04 (Edited 19 Sep 06)
|
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 |
|
 |
|
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!
Already a member? Close this window and log in.
Join Us Close