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

Status
Not open for further replies.

MdVries

Programmer
Apr 16, 2003
47
NL
How can i gather the weeknumber

? date ("w")
? get_dateexpn(DATE(), 'w') ?????
 
Code:
* This will give you the week number for a date variable, dDate
nWeek = WEEK(dDate)
Check the help for the function because there are optional parameters to determine how the starting week is defined.

Regards,
Jim
 

there are optional parameters to determine how the starting week is defined.

The correct parameters for standard week numbers are 2 and 2. In other words:

Code:
nWeek = WEEK(dDate 2, 2)

I've never understood why those aren't the default.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi Mike,

because the week starts Sunday in the US of A (and some other countries). And the first week of a year is also defined as in the default behaviour of WEEK() there, ISO 8601 is not commonly used there, although almost anywhere else in the world.

Take a look at the calendar of Calvin Hsia's Weblog ( it's formatted to have Sunday as day 1 of weeks.

Bye, Olaf.
 

If you use the old trick of going to the user's profile, and hovering over the quotation in the title of his profile "MdVries's Member Profile" you would get, NL, which would indicate Netherlands to me.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Hi Mike,

I don't assume MdVries being in or programming for the USA, i was just answering your question:
I've never understood why those aren't the default.

And because Microsoft resides in USA the default is set to fit there, everyone else needs to set it for their needs.

Bye, Olaf.
 
I think that is not the default setting becuase of bacward compability. I can't remeber in wich version of VFP these additional parameters was added to WEEK() function, but before that WEEK() works as the default now.

Borislav Borissov
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top