Page 1 of 1
How to get week-number of year
Posted: Mon Dec 17, 2007 8:55 pm
by onidarbe
Dos anyone know how to get the number of the week in a year? So Week 1 to Week 53...
Also getting the first day (monday) of a week-number ?
Thanks
Re: How to get week-number of year
Posted: Tue Dec 18, 2007 1:20 am
by TerryE
The answer to this is different depending on whether you are wanting to use Calc functions or native Basic RTL functions. These are documented online in the OOo Help. Go to the Contents tab and drill down to Macros and Programming->Command Reference->Run-Time Functions, Statements and Operators->Date and Time Functions.
So Year(Date) returns the current year, Weekday(DateSerial(Year(Now),1,1) the day of Jan 1 in the current year, etc. There are a number of definitions of Week Numbering but with these functions it is simple to write a function to implement the one that you want.