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

Week Number - First Day 1

Status
Not open for further replies.

PhilMyWallet

Technical User
Feb 20, 2002
84
GB
I have a formula for working out the week number : -

Datepart ("ww",{Stat.Timestamp})

This works fine, except it uses Sunday as the first day of the week.

How can I use Monday instead?


Thanks


Phil
Crystal v8.5
 
Try This

Datepart ("ww",{Stat.Timestamp}, crMonday)

HTH


Gary Parker
MIS Data Analyst
Manchester, England
 
I tried this & it has worked

DatePart ("ww", {Stat.Timestamp},2 ,2 )


Thanks for the quick response though.


Phil
 
Yes that will work as crMonday is a crystal variable for the day of the week which is equivalent to 2, althogh ypu don't need the second 2 as this sets the first week of the year i.e.

DatePart("ww", {Stat.Timestamp},2)

DatePart (intervalType, inputDateTime, firstDayOfWeek, firstWeekOfYear)


Gary Parker
MIS Data Analyst
Manchester, England
 
I tried it without the second 2 however I couldn't get it to start on a Monday for some reason. I ran the report 01/01/06 - 22/01/06. Fixed all the same.


Thanks again



Phil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top