This tip shows you how to convert a date to a week number and vice versa using Formula Language. It was written at R4, and I can no longer remember why it works -- but it does.
The International Organization for Standardization defines Week 1 in a given year as the first week (starting Monday) that contains at least 4 January-days. In other words, Week 1 is the first week that includes a Thursday.
MEMBER FEEDBACK TO THIS TIP
Klavs Thor Olesen says in in his tip that LotusScript can return a Week Number for a Date directly.
I would like to know how, because I have not found any method that does this.
Goran L.
******************************************
It is the Format function I referred to. Here is an example:
Klavs Thor Olesen, tip author
******************************************
This is exactly what I was looking for. I was looking for a formula to calculate a week number field on a form based on a date entered in another field. I typed in calculate week number in a search engine and there it was, number eight in my search result...
To continue reading for free, register below or login
To read more you must become a member of SearchDomino.com
');
// -->

s. It's just what I was looking for and it does exactly what I need it to do. I set the properties of the new field to compute after validation and it works perfectly. Thanks very much.
Bob V.
******************************************
Here is the same function converted to LotusScript:
Also, here's a handy hint for the Formula code, using correct weekdays:
I hope this helps (I've got a calendar population routine in the pipeline that I shall be submitting later). A huge thanks to Klavs for this function; it's a lifesaver!
Andrew D.
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Klavs Thor Olesen. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.