Populate week number: week starts from saturday

Hi All,
We populated the calendar table where we have populated the week number (1-53) by taking sunday as the week start date.
But we need to populate the weeknumber(1-53), with week start day as saturday.Please
Here is the alredy populated data.
Day WeekNumber Mon date
Sunday     1     January     1/1/2012
Monday 1 January 1/2/2012
saturday 1 January 1/7/2012
Sunday 2 January 1/8/2012
we have to populate the weeknumber with saturay as the weekstart date
Thanks All.

Hmmm , after re-reading the OP's question I realise I have provided a comprehensive and well-researched answer to a different question. Must be getting over-excited, it being so close to Christmas. Anyway, I'm going to leave this answer up for the time being, until I can find a better home for it.
The day number is a function of your NLS_TERRITORY setting, a parameter derived from NLS_LANG . For instance when the locale is 'AMERICAN' the first day of the week is SUNDAY but when the locale 'ENGLISH' it's MONDAY. It is possible to mix'n'match language and territory. [url http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch3globenv.htm#i1007222]Find out more.
So, if you set the NLS_TERRITORY to somewhere in the Islamic world, say Kuwait, you will find that Saturday is day 1 of the week. You can do this at the session level:
sql> alter session set nls_territory = 'KUWAIT';
Session altered.
SQL> select to_char(sysdate+1, 'DAY') as day_name
   2            , to_char(sysdate+1, 'D') as day_no
   3    from dual;
DAY_NAME  D
SATURDAY  1Cheers, APC
Edited by: APC on Dec 21, 2012 11:07 AM

Similar Messages

  • Rollover 18 weeks starting from week number of current month

    Hi,
    I have a requirement as described below.
    Table Name Time:
    Columns: Fiscal Year, Fiscal Month and Fiscal Week
    above table has join with sales table and it contain sales data on week basis. so least granularity of data at week level.
    we have a report with columns fiscal year, actual sales and forcast sales. our requirement is to filter the data with following criteria.
    Current Month Filter
    Jan fiscal week between 1-18 of current year
    Feb fiscal week between 5-23 of current year
    March fiscal week between 9-27 of current year
    November fiscal week between week 44 of current year and week 10 of next year
    December
    so with above requirement we need to filter data with rollover 18 weeks starting from week number of current month
    I tried with timestampadd(sql_tsi_week, interval, week) but it's not working as I expacting. Please provide the code/logic to get it done.
    Appreciate your help.
    Thanks
    Jay.

    Jay wrote:
    I need to get rollover 18 week data at anypoint of time starting with week number of 1st of every month to 18 weeks. read my question again and you will be able to understand.You're kind of missing the point to be honest. It's very hard to answer specific questions without the required information. To answer a question like this we need a minimum of:
    1. Oracle version
    2. Sample data (CREATE TABLE / INSERT statements)
    3. Expected output
    4. Explanation of business rules.
    Alternatively, you can read the link in my original response.
    Please provide the required information and someone can help.

  • ORDER way week start from MONDAY [Mon...Sun]

    Display the last name, hire date, and day of week on which the employee hire.
    Order the result by the day of week starting with Monday.
    (eg. Monday,Tuesday……Saturday,Sunday)
    I have tried this using following statement…..But is this right way!? Any other command availabe for same.
    SELECT last_name, hire_date, TO_CHAR(hire_date,'Day')
    FROM employees
    ORDER BY TO_CHAR(hire_date -1,'d') ;
    [FROM  ORACLE University Introduction to Oracle9i: SQL Vol 1, Chapter 3, Q.10, PAGE NO 3-64]

    i think i will also works
    decode(to_char(hiredate,'d'),1,null,to_char(hiredate,'d'))This is very nls-dependant:
    begin
      for cTerr in (select value from v$nls_valid_values where parameter = 'TERRITORY') loop
        begin
          dbms_session.set_nls('nls_territory', ''''||cTerr.value||'''');
          if to_char(to_date(7,'j'), 'd') not in (2) then -- Monday
            dbms_output.put_line(cTerr.value || '=' || to_char(to_date(7,'j'), 'd'));
          end if;
        exception
          when others then
            dbms_output.put_line(cTerr.value || '=?');
        end;
      end loop;
    end;
    /Look for example at BANGLADESH

  • Calendar day to start from Saturday in UAE without changing Calendar language.

    I am non Arabic living in UAE and Saudi Arabia and I want to change my iPhone calendar day to start on Saturday as natives without changing language to Arabic. Is there any way to do it? or did apple has given this choice in IPhone 5?

    At this time the calendar is set for Sunday to Saturday. I would recommend submitting a enhancement request to On Demand customer care.

  • How to get week starting with sunday date

    Hi
    I have a date column "start_date", i need to create a report for all the weeks starting from sunday , for eg:
    i need to get week dates as :
    mm/dd/yy - 01/23/11 , 01/16/11 , 01/09/11 and so on...
    Please help
    Thanks...

    Hi,
    To find the last Sunday before or equal to start_date:
    SELECT     TRUNC ( start_date + 1
               , 'IW'
               ) - 1          AS week_start_date
    ...You can use an expression like this in a GROUP BY clause, also.
    This does not depend on you NLS settings. ISO weeks always start on Monday. Your week starts 1 day earlier, so that's why the expression above has the +1 and -1.
    (Depending on you NLS settings,
    SELECT     TRUNC ( start_date
               , 'D'
               )          AS week_start_date
    ...might do the same thing, but I still rocommend using 'IW'; a few extra keystrokes isn;t much to pay for a guarantee that it will always work.)
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.

  • BI Query - Date Selction- week starts Tuesday

    Gurus,
    We have EP, BI ABAP and JAVA systems on Nw7. All end user executes queries trough EP.
    There are few BI queries where users need to enter date for execution of query.
    For execution of such query user is entering date using F4 (search).
    Select values for Calendar day (COMICAL 0003)--> Opens calendar and it is fine. Issue is week of this calendar starts with Tuesday.
    This behavior varies with workstations. Over few work station calendar week starts on Monday which is required.
    However over few workstations week starts on Tuesday.
    Any guess which property of work station needs to be tuned to have week starting from Monday.
    ps: I have checked Data and time setting of work stations and they are same.
    Thanks !!
    ARD

    Any luck over this vage issue....

  • Calendar starts from Sunday ...

    Hi folks,
    Currently the calendar in BI Publisher starts from Sunday. Is it possible and eventually how to change it as our week starts from Monday.
    Thanks in advance,
    Rossy

    Rossy
    Not in the current release - we are looking to release better control over calendars in an upcoming release.
    Regards
    Tim

  • Displaying Row numbers starting from 1

    Hi every one,
    I want to display row number as see in the report while printing, as I am using the fallowing formula I am getting row numbers including suppress records which I donu2019t want, right now my row number is starting from 10. Instead of 1u2026
    WhilePrintingRecords;
    Numbervar x;
    x:=x+1;
    I want row numbers for only display recordsu2026
    Please help me u2026
    Thanks,
    Krish.

    Krish,
    I am assuming that you are using a conditional formula to suppress the details section. If that is the case then add the conditional suppression logic to your running total formula. For example;
    WhilePrintingRecords;
    Numbervar x;
    If Not (condition for suppression) then x:=x+1 else x;

  • How to return the week number starting from Sunday as the first day

    Hi Friends,
    My application needs to have a report for the weekly totals and must have the Sunday as the first day for the week. For example, January of 2005 should be in the report for having six weeks, Jan 1 is Saturday, this is week 1, Week 2 is from 2 to 8, and the last week , week 6 has 30 and 31. Days need not be displayed, only the week number as follows:
    Week Number Total Sales
    =========== =========
    Week 1 8,525
    Week 2 8,168
    Week 3
    Week 4
    Week 5
    Week 6
    The discoverer hierarchies function for week (eul_date_trunc(item_date, '"W"W')) seems to start the week from the first day of the month regardless of the day. Oracle function TO_CHAR(item_date, 'W') does the same thing, .As the result, the January of 2005 has only 5 weeks.
    Any help or advice for this issue will be greatly appreciated.
    Thank you very much,
    J.K

    Try this
    ---------------------------------------------actual formula---------------
    select ceil(
    ( to_number(to_char(to_date('1-'||to_char(sysdate,'MON-YYYY'),'DD-MON-YYYY'),'D')) -1
    + to_number(to_char(sysdate,'DD'))
    ) / 7
    week_number
    from dual
    e.g try different dates below by replacing 31-Jan-2005
    select ceil(
    ( to_number(to_char(to_date('1-'||to_char(to_date('31-JAN-2005'),'MON-YYYY'),'DD-MON-YYYY'),'D') ) -1
    + to_number(to_char(to_date('31-JAN-2005'),'DD'))
    ) / 7
    week_number
    from dual
    How does it work
    week number is calculated by dividing the current day number by number of days
    so in your case if the week starts at a different day , you just add the offset and divide by 7
    In the first part, i am finding the week day number for the 1st day of the current month and this is used as offset.
    Hope this helps
    -nj
    http://www.infocaptor.com

  • Week Start Date from Week Number

    How would I display the Week Start Date and Week Number for a range of dates.
    required output:
    weekno weekstartdate qty
    11 8/03/04 50
    12 15/3/04 100
    13 22/3/04 75 etc

    Do you have a start and end date and need it expanded to weeks ?
    Let's say you have a table that include both the start and end dates
    select to_char(ddate,'WW'), ddate
          from (select start_dt + rownum - 1 ddate
                  from user_objects,
                       (select min( START_DATE ) as start_dt,
                               max( END_DATE ) as end_dt
                          from MY_TABLE
                          WHERE .... )
                  where start_dt + rownum <= end_dt ) a
      where to_char(ddate,'D') = '1'
    /Of course, one of the problems with WEEK is interpretation. Week one does not start until the First Sunday of the year. Which may or may not be what you want

  • How to get the week start date from ISO week number

    Hi,
    I have a table with the following stucture
    Year    error    Week1     week2   week3 ......week53
    2012       error1     2           4         2             1
    2012       error2    3          0        1                 1I was hoping to get something like select year, error, week1||'Week start date which is a monday of that week' , week2||'Week start date,again monday',....week53 from table
    Any suggestions please?
    Thanks,
    Sun

    Hi, Sun,
    To see when week N started, add 7 * (N - 1) days to the beginning of the year. (By definition, the beginning of the ISO year is the start of week 1 of the ISO year.)
    To see when week 22 of the current year started:
    SELECT  TRUNC (SYSDATE, 'IYYY') + (7 * (22 - 1))
    FROM    dual
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using.
    See the forum FAQ {message:id=9360002}

  • How to get the week number of year from a Date object?

    Hi!
    I would like to know the week number of the year from a specified Date.
    I dont know how to set the first day of week, and set the minimum days of a week.
    I want to use Monday for first day of week, and at least 4 days of month in a week.
    For example if its 1st, January is Friday, then the first week starts on 4th, Monday.
    Anyone can help?

    Sorry. I should think before I move.
         public static int getWeekOfYear(Date date) {
             Calendar calendar = Calendar.getInstance();
             calendar.setTime(date);
             calendar.setFirstDayOfWeek(Calendar.MONDAY);
             calendar.setMinimalDaysInFirstWeek(4);
             return calendar.get(Calendar.WEEK_OF_YEAR);
         }

  • Hi,  iTunes is no longer syncing my iPhoto library to my iPhone 4. Everything was syncing fine when I first got the phone, but, over the past week or so, it's stopped syncing photos.   Now, after attempting to start from scratch by deleting all the photos

    Hi,
    iTunes is no longer syncing my iPhoto library to my iPhone 4. Everything was syncing fine when I first got the phone, but, over the past week or so, it's stopped syncing photos.
    Now, after attempting to start from scratch by deleting all the photos on my iPhone, iTunes won't sync ANY photos from iPhoto back to my iPhone. I've restarted my phone, computer, etc., force quit all photo-related apps on my iPhone, and tried various combinations of turning iTunes' photo syncing on/off, switching photo sync folders, etc., all to no avail -- I can't get my iPhoto library back on to my iPhone no matter what I do.
    Anyone encounter a similar situation? (I've already sent feedback to Apple.) Thanks in advance.

    Try deleting what is called the iPod Photo Cache. 
    http://support.apple.com/kb/TS1314

  • Purchased ML 3 weeks ago from Apps store, started to download then stopped "an error has occurred" tried numerous times since but no success. The ML icon looks to start but says waiting and so am I. Any guidance appreciated

    Purchased ML 3 weeks ago from Apps store, started to download then stopped "an error has occurred" tried numerous times since but no success. The ML icon looks to start but says waiting and so am I. Any guidance appreciated.
    iMac-Mid 2007 MacOSX V 10.7.5

    maybe this will help:
    https://discussions.apple.com/message/19032230#19032230%2319032230
    https://discussions.apple.com/message/19107160#19107160

  • We installed  the Acrobat Reader 11.0.09  on Citrix enable Windows 2008 server  a month ago , it was working.  starting from this weeke we are receiveing error mesaage   AcroRD32.exe - application error  (Instruction at 0x...bad8  bad referenced memory at

    We installed  the Acrobat Reader 11.0.09  on Citrix enable Windows 2008 server  a month ago , it was working.  starting from this weeke we are receiveing error mesaage   AcroRD32.exe - application error  (Instruction at 0x...bad8  bad referenced memory at 0x....bad8 The memory could not be written  Click ok to terminate the program)
    Instruction at 0x...bad8  bad referenced memory at 0x....bad8
    The memory could not be written
    Click ok to terminate the program

    Hi SUBRAMANIAN,
    Are you still facing this issue? It seems to be conflict to me.
    Are you using any third party plugins with Acrobat? Try disabling and to use it again.
    Regards,
    Ajlan Huda.

Maybe you are looking for