Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Week number in the year 1

Status
Not open for further replies.

Budjette

Programmer
Jul 8, 2002
29
0
0
CA
Hi everyone,

Is there a function in crystal 8.5 that returns the week number in the year? Example: the 3rd week of february is the 8th week of the year.

Thank you.
 
I use the following formula to sort my data based on a fixed date for the StartOfYear (eg. The Sunday of the week of January 1st - this year it is 2002/12/29)

Name : {@WeekOfYear}
Formula : (Date({TABLE.DATE/TIME}) - Date (2002,12,29))/7

My field is a Date/Time field and it returns data like this...

DATE/TIME WeekOfYear
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
2003/01/03 11:00AM 1
2003/01/23 11:00AM 4
2003/02/23 11:00AM 8
2003/06/23 11:00AM 25
2003/09/23 11:00AM 38
2003/10/23 11:00AM 43
 
Thank you very much!

Have a nice day.

Budjette
 
This is commonly referred to as a workweek, and Crystal does have a function:

datepart("ww",{table.field})

Keep in mind that there are different interpretations for a workweek, so make sure that you're supplying the requirement.

Datepart has 2 optional parameters to help:

DatePart (intervalType, inputDateTime, firstDayOfWeek, firstWeekOfYear)

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top