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>

Similar Messages

  • 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

  • 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

  • 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

  • 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 find last date of month

    Dear  All,
    Can anybody tell me how to find last date of month I need it to check some validations
    helpful answer will definatly rewarded
    Regards
    Shashikant

    Hi,
    RP_LAST_DAY_OF_MONTHS Determine last day of month
    HR-D: Payroll Germany code
    RP_LAST_DAY_OF_MONTHS
    HR-D: Determine last day of month
    DATE_CONVERT_TO_FACTORYDATE
    Returns factory calendar date for a date Calculates and returns factory calendar date for a date (if CorrectOption = '+');
    Checks if the date is work day (if CorrectOption = '-').
    HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the date is a holiday by checking the parameter HOLIDAY_FOUND.

  • 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.

  • When I open iPhoto 9.2.1 it says that my library needs to be upgraded but when I upgrade the library I am trying to open (33 GB worth of pictures from 2006) the new application says it cannot read the files and how to find them on the system to reimport?!

    When I open iPhoto 9.2.1 it says that my library needs to be upgraded but when I upgrade the library I am trying to open (33 GB worth of pictures from 2006) the new application says it cannot read the files and how to find them on the system to reimport?! and then I'd like to erase the original files since the space requirement is huge!!!! Why is upgrading software iPhoto such a pain. I've gotta get a presentation done and all I get for my money is roadblock!!!

    hello, it sounds like the library is damaged.
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. 

  • 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

  • How to find out about the SMTP Server

    Hi,
    I have been trying to configure groupware in the portal - in particular I want to enable the sending of emails through the portal. I already have a how-to-guide that that seems to explain the steps quite well. However, it mentions that I need to know the SMTP Server of the email. Can you tell me how to find out about the SMTP Server? Where do I need to look for the name of it?
    Thank you and regards,
    Katharina

    Hi Katharina,
    you need the SMTP server of your company. This means you can't look for it in the portal, but have to ask the responsible person in your company.
    Kind regards,
    dominik

  • How to find out whether the system user is a vendor or a purchaser

    Hi,
    I am working in SRM 5.0. I have a requirement that some fields of Bid invitation can be visible by purchaser but not to bidder.
    How to find out whether the system user (user id though which system logged in) is a vendor or a purchaser. Kindly help me to resolve this issue.
    Sushmita Singh

    check his role.
    is surrogate bidding available for that bidder.
    via surrogate bid , purchaser can submit bid on behalf of the bidder.
    masa is correct
    pposa_bbp - search via user . so he might be  a purchaser.
    maintain business partner -supply your bidder bp number -edit
    go to bidder data .Under bidder data you must flag "PERMIT PROXY BIDDING"
    regards
    Muthu
    br
    muthu

  • I'm trying to find the plugin for camera raw, but all I can find is the page with the cameras that are supported. But I don't find how to find and install the actual plugin. The end name is ARW

    I'm trying to find the plugin for camera raw, but all I can find is the page with the cameras that are supported. But I don't find how to find and install the actual plugin. The end name is ARW, and all I need is to find WHERE I can download it. Thanks.

    cr is installed by updating your app.  use help>update, or update manually
    pre cc updates:  http://www.adobe.com/downloads/updates/
    cc updates:  http://prodesigntools.com/adobe-cc-updates-direct-links-windows.html
    cc 2104 updates:  http://prodesigntools.com/adobe-cc-2014-updates-links-windows.html

  • HT4009 I did not download the in-app purchase at time of original App download, now I cannot figure out how to find and download the in-app purchase.  Please help!

    did not download the in-app purchase at time of original App download, now I cannot figure out how to find and download the in-app purchase.  Please help!

    Hello paddyliverpool,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBookstore purchase
    http://support.apple.com/kb/ht1933
    Refund is an option.
    Best of luck,
    Mario

  • I have an app on my iPhone that I want to download on my iPad . Red icon with Chinese writing. Because I do not speak Chinese I do not know how to find it. The application is photography by different individuals of their vacations/trips. Can someone help

    I have an app on my iPhone that I want to download on my iPad . Red icon with Chinese writing. Because I do not speak Chinese I do not know how to find it. The application is photography by different individuals of their vacations/trips. Can someone help

    On your iPad  go to the App Store icon, Tap on the Purchased Tab.
    It will show you all the Apps that have been bought with the Apple Id currently in use by the iPad.
    Assuming its the same one being used on the iPhone, you should be able to find the App there.
    To further help you find it you can tap on the "Not on this iPad" button to limit the results to just Apps not currenlty installed on your iPad.

  • How I find color of the pixel on the screen?, How I find color of the pixel on the screen?

    How I find color of the pixel on the screen?, How I find color of the pixel on the screen?

    DigitalColor Meter, in your Applications/Utilities folder.
    Regards.

Maybe you are looking for

  • Issues with external hard drive

    hello, i recently purchased a seagate external hard drive 2TB. i am trying to copy videos onto the external hard drive from my macbook( mac osx version 10.6.3 but the files wont copy. i checked the details of the external hard drive, formatted for wi

  • How do I setup all my Apple devices for home sharing, messaging, icloud??

    I have FINALLY gotten the last of the Windows machines out of my house... we're 100% Apple now! I have the following Apple stuff: MacBook Pro(my AppleID) -- an iPod Touch and an iPod Nano are sync'ed to  iTunes on the MacBook Pro for music. MacBook A

  • Java plug in 1.4.1_04 the install package could not be opened

    Hi . I am trying to install java plug in 1.4.1 on a Windows XP client SP1 and I receive the following error. Windows Installer The installation package could not be opened. Verify that the package exists and that you can access it, or contact the app

  • Patch for Jahia 3.1 to work WebLogic Server 6.1 with Struts is available!!!

    I have a major patch for Jahia 3.1 server to work on WebLogic Server           6.1 (so far I've tested it against WebLogic Server 6.1 sp3 & sp4, I'm           sure it will work on sp1 and sp2 as well though). We do have complete           support for

  • PDF Scrolling in Safari

    Pdfs scroll very badly in Safari. It is jerky, very sensitive, too fast. This has come up before in the Communities, but the solutions I've found either don't work or aren't relevant after OSX updates. In preview scrolling is well behaved.  Any updat