Sum of weekly data

sum of weekly data.. from daily data.
create table test3(tno number(10), tdate date);
declare
begin
for i in 1..20 loop
insert into test3 values(i,sysdate+i);
end loop;
end;
SELECT * FROM test3;
TNO                    TDATE                    
1                      21-APR-11                
2                      22-APR-11                
3                      23-APR-11                
4                      24-APR-11                
5                      25-APR-11                
6                      26-APR-11                
7                      27-APR-11                
8                      28-APR-11                
9                      29-APR-11                
10                     30-APR-11                
11                     01-MAY-11                
12                     02-MAY-11                
13                     03-MAY-11                
14                     04-MAY-11                
15                     05-MAY-11                
16                     06-MAY-11                
17                     07-MAY-11                
18                     08-MAY-11                
19                     09-MAY-11                
20                     10-MAY-11                
20 rows selected
now i want sum of weekly datasum(tTNO).

Something like...
SQL> ed
Wrote file afiedt.buf
  1  with t as (select rownum as tno, sysdate+rownum as tdate from dual connect by rownum <= 20)
  2  --
  3  -- end of test data
  4  --
  5  select distinct trunc(tdate,'fmIW') as start_wk
  6        ,trunc(tdate,'fmIW')+6 as end_wk
  7        ,sum(tno) over (partition by trunc(tdate,'fmIW')) as sm
  8  from t
  9* order by 1
SQL> /
START_WK    END_WK              SM
18-APR-2011 24-APR-2011         10
25-APR-2011 01-MAY-2011         56
02-MAY-2011 08-MAY-2011        105
09-MAY-2011 15-MAY-2011         39or just a basic SUM rather than analytical...
SQL> ed
Wrote file afiedt.buf
  1  with t as (select rownum as tno, sysdate+rownum as tdate from dual connect by rownum <= 20)
  2  --
  3  -- end of test data
  4  --
  5  select trunc(tdate,'fmIW') as start_wk
  6        ,trunc(tdate,'fmIW')+6 as end_wk
  7        ,sum(tno) as sm
  8  from t
  9  group by trunc(tdate,'fmIW')
10* order by 1
SQL> /
START_WK    END_WK              SM
18-APR-2011 24-APR-2011         10
25-APR-2011 01-MAY-2011         56
02-MAY-2011 08-MAY-2011        105
09-MAY-2011 15-MAY-2011         39Edited by: BluShadow on 20-Apr-2011 13:56

Similar Messages

  • SQL for summing weekly data

    Hi
    I have two tables which has date column and holding more than month data. I want to sum the weekly data starting Monday by combing two table . Can you any help me on to get the SQL for this.
    SQL> select * from ORCL_DATA_GROWTH;
    REPORT_DA DATAGROWTH                                                                                                             
    03-SEP-12       9.78                                                                                                             
    04-SEP-12       5.36                                                                                                             
    05-SEP-12       5.42                                                                                                             
    06-SEP-12      33.36                                                                                                             
    07-SEP-12       5.47                                                                                                             
    08-SEP-12        5.5                                                                                                             
    09-SEP-12        5.5                                                                                                             
    10-SEP-12       9.47                                                                                                             
    11-SEP-12       8.16                                                                                                             
    12-SEP-12      23.97                                                                                                             
    13-SEP-12      51.28                                                                                                             
    14-SEP-12      24.05                                                                                                             
    15-SEP-12      24.03                                                                                                             
    16-SEP-12      24.17                                                                                                             
    17-SEP-12      28.16                                                                                                             
    18-SEP-12      24.17                                                                                                             
    19-SEP-12      24.19                                                                                                             
    20-SEP-12      50.96                                                                                                             
    21-SEP-12      24.19   
    SQL> select * from ORCL_PURGING;
    REPORT_DA PURGING_SPACE FILE_SYSTEM                                                                                              
    01-OCT-12            18 /dborafiles/orac/ora_Test/oradata01                                                                     
    01-OCT-12             0 /dborafiles/orac/ora_Test/oradata05                                                                     
    02-OCT-12            55 /dborafiles/orac/ora_Test/oradata01                                                                     
    02-OCT-12             0 /dborafiles/orac/ora_Test/oradata05                                                                     
    03-OCT-12            21 /dborafiles/orac/ora_Test/oradata01                                                                     
    03-OCT-12             0 /dborafiles/orac/ora_Test/oradata05                                                                     
    04-OCT-12             0 /dborafiles/orac/ora_Test/oradata01                                                                     
    04-OCT-12             0 /dborafiles/orac/ora_Test/oradata05                                                                     
    05-OCT-12             0 /dborafiles/orac/ora_Test/oradata01                                                                     
    05-OCT-12             0 /dborafiles/orac/ora_Test/oradata05                                                                     
    06-OCT-12            70 /dborafiles/orac/ora_Test/oradata01                                                                     
    06-OCT-12             0 /dborafiles/orac/ora_Test/oradata05                                                                     
    07-OCT-12            21 /dborafiles/orac/ora_Test/oradata01                                                                     
    07-OCT-12             0 /dborafiles/orac/ora_Test/oradata05                                                                     
    08-OCT-12            21 /dborafiles/orac/ora_Test/oradata01                                                                     
    08-OCT-12             0 /dborafiles/orac/ora_Test/oradata05 Combining two table and daily out put sample below. But I want to have output by summing weekly value
    SQL> select a.report_date,sum(a.PURGING_SPACE) PURGING_SPACE,b.DATAGROWTH from ORCL_PURGING a ,ORCL_DATA_GROWTH b where a.report_date=b.report_date and a.report
    _date<=(sysdate) and a.report_date >=(sysdate-30) group by a.report_date,b.datagrowth order by a.report_date;
    REPORT_DA PURGING_SPACE DATAGROWTH
    19-SEP-12            77      24.19
    20-SEP-12             2      50.96
    21-SEP-12            47      24.19
    22-SEP-12            19      24.16
    23-SEP-12            22      24.05
    24-SEP-12            25      28.11
    25-SEP-12            43      24.08
    26-SEP-12            21      24.06
    27-SEP-12            22      50.86
    28-SEP-12            22      23.05
    29-SEP-12            22      23.27
    30-SEP-12            22      23.61
    01-OCT-12            18      28.67
    02-OCT-12            55      25.92
    03-OCT-12            21      23.38
    04-OCT-12             0      50.46
    05-OCT-12             0      23.62
    06-OCT-12            70      24.39
    07-OCT-12            21      24.53
    08-OCT-12            21      28.66
    09-OCT-12            51      24.41
    10-OCT-12            22      24.69
    11-OCT-12            23      50.72
    12-OCT-12            22      25.08
    13-OCT-12            25      25.57
    14-OCT-12            21      23.38
    15-OCT-12            22      27.77
    27 rows selected.                               Thanks in advance.
    Edited by: BluShadow on 18-Oct-2012 09:28
    added {noformat}{noformat} tags for readability.  Please read {message:id=9360002} and learn to do this yourself in future.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    user9256814 wrote:
    Hi
    This is my qery
    WITH purging_week AS
         SELECT TRUNC (report_date, 'IW')     AS report_week
         ,     SUM (purging_space)           AS total_purging_space -- same as in main query
         FROM      orcl_purging
         GROUP BY TRUNC (report_date, 'IW')
    ,     data_growth_week     AS
         SELECT TRUNC (report_date, 'IW')     AS report_week
         ,     SUM (datagrowth)           AS total_datagrowth
         FROM      orcl_data_growth
         GROUP BY TRUNC (report_date, 'IW')
    SELECT     COALESCE ( p.report_week
              , d.report_week
              )               AS report_week
    ,     p.total_purging_space
    ,     d.total_datagrowth
    FROM          purging_week     p
    FULL OUTER JOIN     data_growth_week d ON d.report_week = p.report_week
    ORDER BY report_week
    ;That's still hard to read.
    You may have noticed that this site normally compresses whitespace.
    Whenever you post formatted text (including, but not limited to, code) on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.  Blushadow probably won't do it for you every time you post a message.
    This is just one of the many things mentioned in the forum FAQ {message:id=9360002} that can help you get better answers sooner.
    Are you still having a problem?  Have you tried using in-line views?  If so, wouldn't it make more sense to post the code you're using, rather than some code you're not using?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Order changes in Monthly and Weekly Data View

    Hi,
        I need some of your suggestions for my problem below:
    I have a planning book with two data views (1 with monthly bucket and other with weekly bucket).Now I create three forecast orders in the weekly data view as below:
    Quantity     Date
    10         05.11.2007
    20         12.11.2007
    30         19.11.2007
    So I can see the sum as 60 in the monthly data view. Now I try to modify (deduct by 5) the forecast order from the monthly data view. So the sum 60 changes to 55 but when I see the details of the order it looks strange to me.
    11 26.11.2007
    13 19.11.2007
    13 12.11.2007
    13 05.11.2007
    5   01.11.2007
    Please let me know what is the logic behind this?
    But if I perform the above calculation for the category 'HG' as above I get the result like this.
    Weekly Buckets
    10 05.11.2007
    20 12.11.2007
    30 19.11.2007
    Monthly Buckets
    55 01.11.2007
    Thanks,
    Siva.
    Message was edited by:
            sivaprakash pandian

    Hi siva
    This is possibly because of the settings in the planning area for the time disaggregation of the Key figure
    Can you go Planning area administration and see what the setting is in the key figure disaggregation tab?
    I think it needs to be P for proportional distribution and will use previously existing proportions for new quantities.
    instead in your case it is ignoring previously exsisting proportions and distributing afresh. Am not sure what type that is (K?)
    the F1 on the time based disaggregation field will give you a better idea.
    if you want to know why the 11 and 5 are there at the ends and 13 is in the middle buckets, it is because the storage buckets for the weeks have 6, 7,7,7 and 2 days and 55/30 multiplied by these days is how the number are calculated.
    there is also some help here
    http://help.sap.com/saphelp_scm50/helpdata/en/73/3e1167347111d398290000e8a49608/frameset.htm

  • While importing a request error message' Check-sum error in data file'

    Hi Friends
    I have a problem.
    We are trying to inport a request after putting the files in cofile and data file folders( 4.6C System).While doing so an error message is seen in the log " Check-sum error in data file after XXXX bytes".
    Can some one help me with this?
    Thanks
    Regards
    Ankur

    Hi Ankur,
    It is sure your file is corrupted or not present.
    Check in cofiles and data directory under /usr/sap/trans your transport request number.
    Best Wishes.
    Kumar

  • From where to get "First day of the week" data for all the locales, is it present in CLDR spec 24?

    I am trying to get "First day of the week" data from CLDR spec24 but cannot find where to look for it in the spec. I need this data to calculate numeric value of "LOCAL day of the week".
    This data to implement "c" and "cc" day formats that equals numeric local day of the week.
    e.g if "First day of the week" data for a locale is 2 (Monday) , it means numeric value for local day of the week will be 1 if it is Monday that day, 2 if it is Tuesday that day and likewise.

    Hi
    If you want to week to be started with Sunday then use the following formula:
    TimestampAdd(SQL_TSI_DAY, 1-DAYOFWEEK(Date'@{var_Date}'), Date'@{var_Date}') if it's retail week(starts from Monday) then the follow below:
    TimestampAdd(SQL_TSI_DAY, 1-DAYOFWEEK(Date'@{var_Date}'), Date'@{var_Date}')
    I'm assuming var_Date is the presentation variable for prompt...
    Edited by: Kishore Guggilla on Jan 3, 2011 4:48 PM

  • How to display 16 weeks data in the output of the query

    Hi experts,
    I have to display 16 weeks data from current week(Thursday to wednesday).
               (19/07/07 - 12/07/07) (11/07/07 - 6/07/07) like these 16 weeks
                             sales                       sales
    product1              200                         300
    product2              400                         500
    I have to use text variable on createddate char but I do not know how to implement
    the above scenerio.
    Guru's please help me.
    Thanks & Regards,
    James.

    sure james ..
    chk these links..
    text var..
    http://help.sap.com/saphelp_nw04s/helpdata/en/85/e0c73cccbdd45be10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/c1/759b3c4d4d8d15e10000000a114084/frameset.htm
    chk thisthread too..
    Re: Problem with the text variable
    and for replacement paths..
    http://www.sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html
    hope it helps...

  • Previous week Dates

    Hi all
    Please help in writing a query to get the previous week data.
    If the input date is sysdate then it should return values for previous week Monday to Sunday.
    Whatever the input it should get the value for previous week from Monday to Sunday.
    Thanks
    Jo

    IW is the formatter for the "Iso-Week"
    ISO = international standard organization
    See also: http://en.wikipedia.org/wiki/ISO_week
    Main thing is that it will always start with monday. The weeknumber might be different then for ww format. This doesn't matter in your case. But you migh want to do some experiments with to_char(sysdate,'IW'), to_char(sysdate,'WW').
    Trunc(<datevale>,'IW') will cut the date back to the first day of this iso-week.
    select to_char(sysdate-365,'IW') IW , to_char(sysdate-365,'WW') WW from dual;
    IW     WW
    37     36Edited by: Sven W. on Sep 9, 2010 2:29 PM

  • Previous weeks data

    Hi all,
    I have a requirement where I need to show the Unbilled amount of this week as well as last 20 weeks based on region. Let say I am on fiscal week 20. Now if create a report based on region and Unbilled amount I will get $ 20 for europe. Now if after one week i.e FW 21 , I run the same report I get & 25 for Europe. Again let say after one more week i.e FW 22 I get $ 27 for Europe.
    Now user if run a report on FW 22. he wants areport like
    Week   Region  Unbilled
    FW20   Europe  $20
    FW21   Europe  $25
    FW22 Europe    $27
    i.e history data is required . As data is changing every day , user wants to see previous 20 weeks data.
    Now I am using a Zcube built on standard extarctor 0FI_GL_4. i dont have loading date or system date.
    Please suggest what to do
    Regards,
    Sunny

    Hi.
    If your object fiscal week restricted by variable you should do the next:
    1. create 20 calculated KF each one restricted with this variable with appropriate offset (lets say previous week wth vriable and offset -1, 2 weeks ago with variable and offset -2 ...)
    2. create another calculated KF with variable without offset to represent user selection week.
    So at the end you will see one KF with current week and 20 another KF with 20 previous weeks.
    Regards.

  • Sum from current date to the last date of sales

    Hi 
    It's been a while since I used MDX last time. 
    I have a simple question (probably). I need a measure which sums up from the current date to the last sale date. 
    It's like a reversal of Year To date.  And I need to do it date level. 
    Let's say is the sales goes like
    1/May/2000     $1000
    2/May/2000     $1000
    3/May/2000     $1000
    4/May/2000     $1000
    5/May/2000     $1000
    I need to create a measure which displays sum of current sales and last sales
    1/May/2000     $5000  
    2/May/2000     $4000
    3/May/2000     $3000
    4/May/2000     $2000
    5/May/2000     $1000
    I have a date hierarchy and hope it can be rolled up. 
    And I tried like something like ( suggested in another posting)
    [Date].[Calendar].CurrentMember:NULL}
    But this does not work for me.
    The actual MDx I wrote is 
    With member MEASURES.ActiveLicences as 
    sum ( 
    {[License Expiry Date].[FinancialYear].[YY-MMM].CurrentMember: null},
    [Measures].[No of Students]
    select {
    MEASURES.ActiveLicences,
    [Measures].[No of Students] } on columns, 
    [License Expiry Date].[FinancialYear].[YY-MMM].members on rows 
    from [Sales];
    Can anyone help me with this please? 
    Kind regards
    Mark Kim

    Hi SQLMa ,
    I was trying a similar code, using a hierarchy expression instead of a member expression for the CurrentMember functionality . Here is an Adventure Works example :
    With member MEASURES.ActiveLicences as 
    sum ( {[Delivery Date].[Fiscal].CurrentMember: null}
    , [Measures].[Internet Sales Amount]) 
    select {MEASURES.ActiveLicences,[Measures].[Internet Sales Amount]} on columns
    , [Delivery Date].[Fiscal].[Month].members on rows 
    from [Adventure Works]
    Hope it helps :)
    Regards, David .

  • Previous week data required

    Hi all,
    In my query user want to compare this week data verses previous week data. How can I get data which are there in previous week.
    I donu2019t have loading date in my info provider.
    Please suggest.

    Hi,
    See the Customer Exit Code, you need have only 0CALDAY incube you can get the data.
    ZCDAY = Use input Variable on 0CALDAY
    ZFDFW & ZLDFW  are Customer Exit variables on 0CALDAY.
    To Get the First day of First Week in given Date
    WHEN 'ZFDFW'.
          DATA: zdf1 TYPE sy-datum,
                zldate TYPE sy-datum,
                zday(2) TYPE n,
                zmnth(2) TYPE n,
                zyear(4) TYPE n.
          zday(2) = '01'.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZCDAY'.
            CLEAR l_s_range.
            zmnth = loc_var_range-low+4(2).
            zyear = loc_var_range-low+0(4).
            CONCATENATE zyear zmnth zday INTO zdf1.
            l_s_range-low = zdf1.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
            CLEAR l_s_range.
          ENDLOOP.
    To Get the Last day of First Week in given Date
    WHEN 'ZLDFW'.
          zday(2) = '07'.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZCDAY'.
            CLEAR l_s_range.
            zmnth = loc_var_range-low+4(2).
            zyear = loc_var_range-low+0(4).
            CONCATENATE zyear zmnth zday INTO zdf1.
            l_s_range-low = zdf1.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
            CLEAR l_s_range.
          ENDLOOP.
    Note: In this way you need to calcukate, here I'm dividing the month into weeks based on 7 days this is my company policy, so you need to check with your Functional team how they divides a week in a month.
    Thanks
    Reddy

  • Week-Data view issue

    Hello Experts.
    In month dataview when we copy value from one KF to other via macro, it gets copied correctly, but when a week lies in two month, the values is not correctly copied.
    Take e.g. of last week of Aug 2011, where it lies in Aug as well as in Sept.  In Month dataview the values are copied corrected in Aug & Sept, but not in week view. Can anyone please help me, how to fix this. We want the same values in week data view too.
    Regards
    Rahul Chitte

    Rahul
    I think you will notice a difference between monthly and weekly views when the week falls in two months. Taking the same example that you have used , lets say the value for august month is 100 ( for the last week that falls in aug and sep the value is 25  + 35  for the 3 days of aug it is 25 and for 4 days in sep it is 35).  So in the monthly view you will see 100 and this 100 will just include the 25 of the last week and the 35 will be taken into account in sep month. But in the weekly view the entire 25+35 (60) will show up against that  the last week  of aug and that makes perfect sense . If your doubt is still not clear , please elaborate your requirement
    Thanks
    Aparna

  • SQL to generate last weeks date(not a stored procudure)

    I need SQL to generate last weeks dates starting from Monday to Sunday. I don't want to use any table data or stored procedure. I need inline SQL. Please help me with your suggestions. Thanks in advance for the help.

    varun wrote:
    I need SQL to generate last weeks dates starting from Monday to Sunday. I don't want to use any table data or stored procedure. I need inline SQL. Please help me with your suggestions. Thanks in advance for the help.below should get you started
      1* SELECT SYSDATE-LEVEL from dual CONNECT BY LEVEL < 8
    SQL> /
    SYSDATE-L
    21-APR-13
    20-APR-13
    19-APR-13
    18-APR-13
    17-APR-13
    16-APR-13
    15-APR-13
    7 rows selected.

  • Disaggregate Periodic Data to Weekly Data (Modeling Time Dimension)

    Hi,
         We are using BPC MS Version 7.0. Our users plan at period level and I need to disaggregate periodic data to weekly data by looking up weeks from Time Dimension.
    Suppose if 2009.Jan  has 4 weeks I need the following result
    Periodic Data
    2009.Jan Acct1 1000$
    Weekly Data
    2009.Jan Wk1 Acct1 250$
    2009.Jan Wk2 Acct1 250$
    2009.Jan Wk3 Acct1 250$
    2009.Jan Wk4 Acct1 250$
    Can we model Time Dimension with two hiearchies to achieves this?
    Which is best way to dissaggrate? (Stored Proc or SSIS Pacakge or Script Logic) ?
    Thanks
    Raj

    An easy way to achieve this feature is to have the time dimension be weekly and do the spread on the input schedules before sending. 
    There would be two EVDREs (one refresh only of monthly data and the other send only of weekly data).  The data range of the monthly EVDRE would be input and where the user enters data.  The data range of the weekly EVDRE would be formulas (pointing to the monthly data and doing the correct division based on number of weeks in a month).  The user is inputting monthly data, but the schedule is sending the weekly values.
    The allocation will work as well, but I would suggest to create a weekly input node under each month to capture the monthly value and then spread to the weekly members.
    JAN
    |---WK Input
    |--- WK1
    |--- WK2
    |--- WK3
    |--- WK4

  • Run the query with previous weeks date automatically

    Hi Guyz,
    I need to  dynamically populate the previous weeks  date value every week,
    i.e Run the query every Monday automatically, with previous weeks date value .
    Is there any SAP Exit which I can use ??
    Regards,
    Ravi
    Edited by: Ravi Srinivas on Aug 4, 2009 1:40 PM
    Edited by: Ravi Srinivas on Aug 4, 2009 1:52 PM

    Ravi,
    If you are thinking of re-running the previous week's queries automatically in the front-end, then U. Tummers is correct.  You can create new columns alongside your existing query if you so wish and use your restrictions with an offset sepending on how far back you'd like to go.
    Best,
    Philips

  • Sunday 17-Jan-2010: In week 2 or week 3? Does Apple use ISO week dates?

    According to Wikipedia, http://en.wikipedia.org/wiki/ISOweekdate "All week-numbering years start with a Monday and end with a Sunday."
    http://personal.ecu.edu/mccartyr/isowdcal.html shows this too.
    However, my MBP running 10.5.8. shows today, Sun 17 Jan 2010 as week 3.
    This can be seen quickly by, following http://lifehacker.com/316029/display-the-date-on-the-menubar and dragging the Week of Year into the clock time shown on the menu bar, and viewing it on a Sunday.
    Or does Apple not follow the ISO week date numbering standard?
    Thanks,
    Martin.

    red_menace wrote:
    Actually, Apple does use (or is supposedly using) ISO 8601, but the System Preferences settings can override some of these, such as the region, calendar, or first day of the week.
    Actually, I think it is still an open question. According to Apple developer documentation:
    NSISO8601Calendar Identifier for the ISO8601. The ISO8601 calendar is not yet implemented.
    It does look like some of the conversions are a bit off, even in Snow Leopard, unless there is something I'm missing, too. Changing the date format (week starts with Monday) in System Preferences shows the correct week there (2), but getting the date from AppleScript, for example, shows week 3.
    I played around with my system preferences and could change the week start day, but I could never get an ISO 8601 date. Today (Sun, Jan 17th, 2010), I get either week 4 (Sunday) or week 3 (Monday).
    Clearly there are lots of date and time APIs to choose from and many of them on MacOS X already support this format. They haven't made it to the official system preferences level. Considering all the other calendar formats that Apple supports, I think this is a bug and mostly reflects MacOS X's American heritage. Americans don't use this value at all and don't even know to add it to a locale option.
    I filed a bug report on it. Don't hold your breath for it getting fixed anytime soon. In the meantime, here is a widget that will display the current week number: http://www.apple.com/downloads/dashboard/status/weeknumber_ntnu.html

Maybe you are looking for