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

Week Number

Status
Not open for further replies.

Lochbel

Technical User
Dec 5, 2002
125
AU
Is there a technique i can use to set the week number by specificing a non standard start date.

e.g week commences 01/07/yyyy

TIA

Lochbel
Australia
 
Depends on what you want to use it for.

DateDiff, DatePart, and WeekdayName all support a first day of week constant. DatePart also supports first week of the year values.


 
For a week number, use
Code:
DatePart ("ww", {date1})
That gives a number, 01 to 53, with adjustments possible to start in some non-standard way.

You could enter the number of the week as a numeric parameter, check it against the DatePart value from the dates.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
If you first insert a group on {@fiscalyear}:

{table.date}+184

You can then use a formula like this for weeknumber:

if month({table.date}) >= 7 then
datepart("ww",{table.date},crSunday)-26 else
datepart("ww",{table.date},crSunday)+26

At least this should get you close to what you're looking for.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top