Starting date of every week of the month

dear members
how can i find from dual, the start date of every week of the month in a year.
start of week days is the 'Monday'
year month week day date
2011 JAN 1 Monday 03-jan-2011
2011 JAN 2 Monday 10-jan-2011
2011 JAN 3 Monday 17-jan-2011
2011 JAN 4 Monday 24-jan-2011
2011 JAN 5 Monday 31-jan-2011
thanks
teefu

Hello,
You can use this :
with t as  (select to_date ('01/01/2011', 'DD/MM/YYYY') start_date from dual)
select  date_calc
from (
        select  start_date,
                (level-1)*7+trunc (start_date , 'D')+1   as date_calc
        from t
        connect by level <=53)
where trunc(date_calc,'YYYY')=trunc(start_date,'YYYY') ;Regards,
Sylvie

Similar Messages

  • Get first week of the month

    Hi,
    how to get first week of the month from the query
    i tried this but not gwtting
    SELECT TO_CHAR('09/30/2007','W') FROM DUAL
    thanks
    Edited by: 896398 on Jan 18, 2012 3:17 AM

    896398 wrote:
    how to get first week of the monthAssuming week starts Sunday:
    SELECT  GREATEST(TRUNC(TRUNC(your_date,'MM') + 1,'IW') - 1,TRUNCyour)date,'MM')) week_start_date,
            TRUNC(TRUNC(your_date,'MM') + 1,'IW') - 1 + 6) week_end_date
      FROM  dual
    / If week starts Monday:
    SELECT  GREATEST(TRUNC(TRUNC(your_date,'MM'),'IW'),TRUNCyour)date,'MM')) week_start_date,
            TRUNC(TRUNC(your_date,'MM'),'IW') + 6) week_end_date
      FROM  dual
    / SY.

  • Week of the month !!

    Hi,
    how can i get the week of the month so i can use it on queries like a time characteristic ?.
    thanks in advance

    Hi,
    The function module DATE_GET_WEEK gives the week no in that year in 2 digits. By using this function module twice , you can find out the Week in the month.(i.e use FM to calculate week no for month starting date, and use it second time to calculate the week no of the date,and then findout the difference).
    With rgds,
    Anil Kumar Sharma .P

  • How to get last week of the month from a month

    Hello,
    I want to get last week of the month from a month. For example: If Input = April then Output = Week17. Is there any function module? Or what should be the logic inorder to meet such requirement?
    Thanks in advance for your answers.
    Nitin.

    Hi,
    Just cpoy and past this program, and see the result and apply for you requirements.
    Data: ZSCDATUM TYPE SCDATUM,
          ZKWEEK TYPE KWEEK,
          ZDAY TYPE SY-DATUM,
          ZLDAY TYPE SY-DATUM,
          ZWK(3) TYPE N,
          ZM(2) TYPE N.
          ZDAY = SY-DATUM.
          ZM = ZDAY+4(2).
          CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
            EXPORTING
              day_in                  = ZDAY
            IMPORTING
             LAST_DAY_OF_MONTH       =  ZLDAY
    *       EXCEPTIONS
    *         DAY_IN_NOT_VALID        = 1
    *         OTHERS                  = 2
          IF sy-subrc <> 0.
    *         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          ZSCDATUM = ZLDAY.
          CALL FUNCTION 'DATE_GET_WEEK'
            EXPORTING
              date               = ZSCDATUM
           IMPORTING
             WEEK               = ZKWEEK
    *       EXCEPTIONS
    *         DATE_INVALID       = 1
    *         OTHERS             = 2
          IF sy-subrc <> 0.
    *         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          ZWK = ZKWEEK+4(2).
          WRITE: ZKWEEK.
          WRITE: ZWK.
    Thanks
    Reddy

  • I need to run the job  every 8th of the month

    Hello,
    Can you please help me out to run the oracle job every 8th of the month.
    Thanks in advace
    Kind reagrds,
    Nick

    Untested, but I'd say the repeat_interval clause of dbms_scheduler.create_job should be something like:
    'FREQ=MONTHLY;BYMONTHDAY=8;'

  • To run a job on 1st and 2nd week of the month.

    I need to schedule  a job on 1st full week and 2nd full week of the month.  What is the best way to identify the Week and trigger the job?  Any input is appreciated.
    thx
    Jeff

    Hi Jslader,
    I agree with the 1st option of Visu - by calendar.
    For example, assign the CALENDAR parameter to MNTH-12WK (example only) unless there are predecessors of the job you have created.
    Best regards,
    Sev

  • User start date can not be before the current date

    I'm creating users using the Reconciliation engine. The start date attribute doesn't appear to be reconciling. I get many different types of parse errors. The closest I appear to get is when I set the Xellerate User resource object recon field to have Start date as a date field, i receive the error:
    "User start date can not be before the current date.".
    I'm using 9.0.1.1. And I AM trying to create a user that has a start date before todays date.

    Resolution was to patch to 9.0.1.1578

  • How to calculate last week of the month

    i want calculate dollar on the basis of last week of the month.

    Hi prashant,
    try to filter with the required month. if this is not your question, explain little bit clear..so, that some one will help you if they have the solution with.
    or do you want to create a variable and then filter prompts...
    cheers...
    Edited by: ManiEswar on 24-Jan-2011 12:59

  • Getting the exact date of current week and current month

    I would like to know is there any methods to know the exact date of the current week and current month?

    //use this function like this
    //String date = getNow();
    public static String getNow()
         Calendar cal = new GregorianCalendar();
         // Get the components of the time
         int hour24 = cal.get(Calendar.HOUR_OF_DAY); // 0..23
         int min = cal.get(Calendar.MINUTE); // 0..59
         int sec = cal.get(Calendar.SECOND); // 0..59
         // Get the components of the date
         int year = cal.get(Calendar.YEAR); // 2002
         int month = 1 + cal.get(Calendar.MONTH); // 0=Jan, 1=Feb, ...
         int day = cal.get(Calendar.DAY_OF_MONTH); // 1...
         String timeStamp = String.valueOf(year) + "-" + addZero(month)+ "-" + addZero(day)
              + " " + addZero(hour24)+ ":" + addZero(min) + ":"+ addZero(sec) + ".0";
         return timeStamp;
    public static String addZero(int num)//this function works with the getNow() function
    //all it does is adds a zero to an int if its less then ten
         String val = "";
         if(num < 10)
         val +="0"+num;
         }else{
         val = String.valueOf(num);
         return val;
    }

  • 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 can I alter a calendar script to place progressive dates on every day in the calendar year?

    Is there an easy way either to alter the calendar script or create something that will allow for variable text in each day of the year?
    I am creating a calendar for a cattle rancher, and he wants to include a gestation calendar in the design.
    So...instead of the Julian date on every caledar day, he would like to include the date that a calf will be born if the cow had been bred on a particular day.  For example:  On the calendar date, January 1, in that box, another smaller date will appear - 10/9, On January 2 - 10/10 and so on. But, I need this progression to continue throughout the whole year.
    I have attempted to manually enter each date in a separate table and super impose it over the calendar, but this is very slow and very tedious. There has to be a faster way.
    I am comfortable looking at code and can often times figure out which fields to change, but I am a bit lost on this one. Where do I start?
    Please help!
    Thanks!

    That helped, but still did not solve the "continous scroll" question.
    I did however discover that if you go to Search and type in a "common" letter like "s", a Continuous List view will appear.
    Any further help on how to do this as a default view would be appreciated from any and all.
    Thanks for the help and for the link paulcb.

  • Setting up the sender communication last week of the month

    Hi All,
    I am doing right now JDBC to RFC, now my problem is i need to featch the data in this way "daily during the last week of the fiscal month, and first few days of the following month" i need to extract the data and send it RFC as receiver.
    How can i schedule my JDBC Adaptor communication chennal..
    I have checked with Availability Time Planning  but i am not sure how i can do it.
    Could you pls give some info how can achive this.
    Thanks in advance
    Venkat

    Hi,
    the problem is that you can't trigger the JDBC Sender Adapter.
    There was already a similar discussion in this thread:
    How to trigger XI scenario from a SQLServer Database?
    Regards
    Patrick
    (Sorry it was a wrong link first)
    Edited by: Patrick Koehnen on Jan 19, 2009 12:25 PM

  • Repeating Events for the Fifth Week of the Month

    Hello,
    I am attempting to create a calendar schedule to distribute to members of my club. Each member is responsible for a certain day of the month (eg, every first monday).
    iCal gives me the option to select every First, Second, Third, Fourth, or Last weekday of the month for repeating events. Did Apple forget that some months have five weeks in them, or am I really going to have to schedule events for the fifth week manually?
    Thanks,
    -Noel
    Mac Mini   Mac OS X (10.4.8)  

    Hi Noel,
    Welcome to Apple Discussions.
    iCal does not have this feature.
    I tried playing around by scripting the addition of events with the correct rfc2445 recurrence string, but in iCal the events were placed in the first week of the following month on months with four weeks.
    If you want this feature in the future, ask Apple for it.
    Best wishes
    John M

  • How to find week of the month

    Hi Friends,
    i want to find the week of a month when i pass a date
    example : i will pass "7-jun-07" as input
    i would like to get "2" as the out put
    is there any built in to do so
    please suggest me
    regards,
    Khader

    your query seems to be wrong:
    SQL> with c as
      2  (select to_date('1-jun-07','dd-mon-yy')+level-1 your_day from dual connect by level<=15
      3   )
      4  select your_day, to_char(your_day,'day') week_day, case when to_char(your_day,'fmday') = 'sunday'
      5         then to_char(to_number(to_char(your_day,'w'))+1)
      6         else
      7         to_char(your_day,'w') end ushitaki_week_no,
      8         to_char(your_day,'iw')-to_char(trunc(your_day,'mm'),'iw')+1 week_no_in_month--for expicit conversion use to_number
      9   from c;
    YOUR_DAY    WEEK_DAY  USHITAKI_WEEK_NO                         WEEK_NO_IN_MONTH
    01.06.2007  friday    1                                                       1
    02.06.2007  saturday  1                                                       1
    03.06.2007  sunday    2                                                       1
    04.06.2007  monday    1                                                       2
    05.06.2007  tuesday   1                                                       2
    06.06.2007  wednesday 1                                                       2
    07.06.2007  thursday  1                                                       2
    08.06.2007  friday    2                                                       2
    09.06.2007  saturday  2                                                       2
    10.06.2007  sunday    3                                                       2
    11.06.2007  monday    2                                                       3
    12.06.2007  tuesday   2                                                       3
    13.06.2007  wednesday 2                                                       3
    14.06.2007  thursday  2                                                       3
    15.06.2007  friday    3                                                       3
    15 rows selected
    SQL>

  • Network Header Start Date is not accepted by the system

    Hi,
      When I try to create a Network and put the start date I get an error message-
    Date 01.01.2011 is later than the validity period of the factory calendar
    Message no. CO032
    Procedure
    Enter a date which lies within the validity period of the factory calendar.
    And this does not allow me to cfreate the network.
    But the same date is accepted by the system for WBS element and activities.So I doubt it has anything to do with the factory calendar.
    Please assist.
    Thanks and Regards

    Hi,
    The validity end-period has been maintained as 2011 for the calandar.
    One difference I noticed is that for activity and WBS element the calendar maintained is 01.While for network header we do not have any explicit factory calendar concept but I think the system derives the Factory Calendar from the assigned Plant.But even in the Plant the Factory Calendar maintained has the validity end-period as 2011.
    In the network header's Basic Start field when I hit F4,then all the 2011 dates show in Italics-like the non-working SAT and SUN days.
    Thanks and Regards

Maybe you are looking for

  • Showing image from database

    Hi, can anyone tell/give me an example/tutorial of how to retrieve the image from the database into forms? so i have a table names EMPLOYEES for example, and i added a clob type column, named "photo". in forms, when i show the informations for each p

  • Parsing a portlet in Portal

    Hi all, I have a requirement and we are trying to look for an approach that doesn't need development or at least not a huge development effort. The scenario is the following. We have a portlet deployed in a JBoss server. This portlet is consumed by W

  • Authorization error in PA40 (HR)

    Dear Experts, Some of our HR users start complaining that they have authorization problem in PA40 (Hiring Activity). When I looked into SU53 details, I found that authorization check failed at object P_ORGIN. I cross checked the authorization in user

  • How can I recover photos from iPad to my Mac?

    Hi! Have myself in a bit of a situation and I'm hoping there's an easy answer that I haven't found yet. Last night, my external drive that I kept my media on died. No problem, right? I use Time Machine like a good boy... ...and then I see that TM exc

  • How does one use bluetooth to send and recive on t...

    sending and reciving via bluetooth using nokia lumia 610