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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Week number 3

Status
Not open for further replies.

acessn

Programmer
Feb 16, 2005
71
NO
Using Crystal Reports 9.0, Microsoft SQL server db

I have a date, and need to determine the week number of that date.

I.E. 21.03.2005 needs to return week number 12.

Any ideas?

Regards Bjørn
 
try this ...

DateDiff ("ww", date(year(today),1,1), today);

It's the number of 'start of weeks' after the first date and including the second date. There is a "w" argument as well that is slightly different.

There is further information in the help file.
 
Try:

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

You can change the way you count week 1 of the year by adding conditions to this formula for the first day of the week and the first week of the year, as in:

datepart("ww",{table.date},crMonday, FirstFullWeek)

The help files will give you the other options you can use for these conditions.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top