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 FUNCTION

Status
Not open for further replies.

NW

Programmer
Feb 3, 2000
61
GB
Is there a function to return the actual week no for a given month?
Date in British format
i.e
01/01/200 to 07/01/2000 ---> return 1
08/01/200 to 14/01/2000 ---> return 2

Thank in advance!
NW [sig][/sig]
 
I don't think this is exactly what your looking for. but it might help anyway.

x = {^1999-09-07}
? INT(DAY(x)/7)+1


Good Luck [sig]<p> Pete<br><a href=mailto:blindpete@mail.com>blindpete@mail.com</a><br><a href= > </a><br>What your mother told you is true! You will go blind! (from moonshine anyway)[/sig]
 
If you want the actual Week of the Month
[tt]
*/***************************************************************************
*/Program : function WOM (Week Of Month)
*/System :
*/Purpose : Return the week of the month the date is
*/Syntax : Week = wom(date())
*/Returns : integer - week - the number of the week the date is located in
*/Parameter : date - date - the date to be evaluated
*/Defaults : date = date()
*/Requires : nothing
*/Changes : nothing
*/Calls : nothing
*/Version : 1.0
*/Dated : 06/01/93
*/Written By: David W. Grewe
*/Assumption: A new week starts with a Monday
*/***************************************************************************
*& Date Function
*/***************************************************************************
*/ Record Of Change
*/
*/***************************************************************************
parameters pdDate
if parameters() < 1 .or. type(&quot;pdDate&quot;) # &quot;D&quot;
pdDate = date()
endif
lnStart = pdDate - day(pdDate)+1
lnWom = 1
do while lnStart <= pdDate
if dow(lnStart) = 2
lnWom = lnWom + 1
lnStart = lnStart + 7
else
lnStart = lnStart + (9 - dow(lnStart))
endif
enddo
return lnWom
[/tt]
[sig]<p>David W. Grewe<br><a href=mailto:Dave@internationalbid.net>Dave@internationalbid.net</a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top