How to get day from Week Number

Hi all,
how to get date from the week number when the day is MONDAY.
like : week num =33
how get the date of the day MONDAY from this..

SQL> select
  to_char(d,'YYYY') y,
  w,
  trunc((trunc(d,'Y')+w*7-date '1000-01-01')/7)*7+date '1000-01-01' monday
from
(select sysdate d, 33 w from dual);
Y             W MONDAY
2005         33 15.08.2005Message was edited by:
Laurent Schneider
I wrote an article which may help you to get out of the mess with weeks that start on friday, saturday, sunday, monday
http://laurentschneider.blogspot.com/2005/07/tochar-d.html

Similar Messages

  • How to get day of week from NSDate?

    How to get day of week from NSDate?

    Here's a way to get the name of the weekday as an NSString if you've already got an NSDate...
    NSDate * testDate = [NSDate date];
    NSString * weekdayString = [testDate descriptionWithCalendarFormat:@"%A" timeZone:nil
    locale:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]];
    NSLog(@"Day of the week: %@", weekdayString);
    The output is something like:
    Day of the week: Monday
    You can use a lower-case "%a" as the descriptionWithCalendarFormat if you just want the three character weekday abbreviation ("Mon", "Tue", "Wed", etc).
    Steve

  • How to get a proper week number and MATCHING year number

    Java classes such as SimpleDateFormat offer convenient means to find out the correct week number of a given date. Week numbering is locale specific and not always intuitive. For example, Dec 31, 2001 is in week 1 of 2002 in locales where a week starts with Monday or Sunday. Now, if one formats the date using a method such as:
    new SimpleDateFormat("'week: 'ww', year: 'yyyy").format(theDate);
    this produces result
    week: 1, year: 2001
    when the typically anticipated value would be "week: 1, year: 2002".
    Is there any means to find out the year number, which matches to the given week number for a date? Or do I have to create a kludge myself?
    I would be suprised if this feature is not part of Java API, since it seems like a quite common need. Then again, I'm not suprised by surprises in Java API anymore ;)

    Well, the real problem is just that the rules determining which year the week belongs to are complicated. In some locales, weeks start with Monday, in some Sunday. In some locales year that has 4 or more days of the week "owns" the week, in some locales there might be different rules.
    All this complex logic is already implemented in Calendar / SimpleDateFormat / etc classes, so it would be clearly valuable thing to be able to use that code. For example, Calendar.get(YEAR_OF_WEEK_OF_YEAR) or similar. But, it does not seem to be possible.
    As I mentioned originally, I can implement my own "kludge" to do this if I have to. This is not nice, since I will be duplicating the functionality already implemented in the calendar classes. Of course, solution is neither as simple as "set calendar to the weeks end" or "set calendar to the weeks start"...

  • How to get agreement from promotion number ( using BAPI_AGREEMENTS)

    Hi experts,
    I have a requirement where  I need to  generate agreement from promotion number( As in transaction WAK2) programatically, 
    I have tried using 'BAPI_AGREEMENTS' but could not pass promotion number in it , would appreciate any help on this.
    If any other BAPI OR Function module can be used please intimate.
    Thanks
    Koyel

    If you are using the PDFL, there is not current page number - you are not
    displaying the document, so there is no way to get from a PDDoc to a page
    number. If you do have the PDPage, you can just use PDPageGetNumber() to
    get the page number.

  • I'm using same icloud and same apple ID on two iphones. Now i get calls from same number on both iphones at the same time. How to turn off that?

    I'm using same icloud and same apple ID on two iphones. Now i get calls from same number on both iphones at the same time. How to turn off that?

    Apple ID's are not device specific, so when you changed it on the iPad 2 it changed it on the iPhone 4 as well, since it's the same account still. What you need to do is create a second Apple ID (so you'll have two accounts, one for iPhone 4 and a seperate one for iPad 2).
    To create a new Apple ID on your iPad 2:
    1) Go into Settings > Store.
    2) If you are already signed in, tap your Apple ID on the screen and you will be given a few options, one of which is to sign out of your account.
    3) After you sign out, now click the "Sign in" button.
    4) Tap "Create New Apple ID" and follow the instructions on-screen.

  • How to get the current week from sysdate?

    Hi sir,
    i want to know how to get the current week from sysdate?
    thanks

    Hi Nicolas
    It seems you like to check my post and also make commend ;) thanks for your attention
    Have you ever read the posts above and given solutions ?Yes, I did
    Have you read the docs ? Yes, I checked
    What's the added value here ?Did youYou shared doc with solution(long one), I shared short one which point same solution(Check what Joel posted)..So what is benefit, As you can guess oracle docs are sometimes become so complicated as specialy for beginner...(At least it was like that for me and Belive me somedocs are still sooo complicated even for oracle coworkers ) But for you I dont know ;)
    => Why writting the PS in bold ?Why.. Let me think... Ohh Maybe I am looking some questions(many) and even user get answer they should not changed status so I am reading some posts and try to get problem and loosing time..
    So I am putting that PS wiht BOLD because I dont wanna lose time my friend ;) Because While I am trying to help ppl here In same time I am trying to giving support to my customer prod systems. Which mean time is very important for me...
    Hope my answer could satisfy you..
    One important PS for you.. You may not like my posts (or someone) but my friend I become tired to read&answer and make commend to on your comment which is about my posts.
    I am not newbie in forum(At least I fell like that) and I belive I know how I should make post..
    Thank you
    Regards
    Helios

  • I am getting messages from a "number" which is not enough digits to be a real number.  It includes a website to follow. How do I block?

    I am getting messages from a "number."  I have gotten three messages and the ending digits have been 001, 002, and 003, so I can't block just one number.  They always include an e-mail address, subject, and web page to click on, which I have never done.  I don't even open the message, but just swipe to delete.  I am tired of getting them though.  Anybody know what to do to send to a spam account or block?  Thanks.

    Did you sysc youriPod to your computer. If not, you have nothing to worry about. If you did sync it, you don't have to transfer the files from the iPod. Suggest you read the iPad manual.
    Suggest you download the iPad User Guide
    http://support.apple.com/manuals/#ipad
     Cheers, Tom

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

  • How to get the current month number

    Hi everyone,
    Does anybody know how to get the current month number in Oracle Discoverer Worksheet calculation?
    I try to use EUL_DATE_TRUNC(CURRENT_DATE, 'MM'), but instead I got 01-AUG-00.
    If I change the data display format to MM, it will give me "08" but if I use TO_NUMBER function to convert it to number I get error "invalid number"
    Is there anyway to get the current month value in number? Thanks

    Scott,
    Thank you so much! It works perfectly! :)
    Hope you have a great day ahead!
    Cheers,
    Angeline

  • How to get the unoccupied material number in a number range

    How to get the unoccupied material number in a number range.for example, I wang to get a number between 1500000 and 1599990 which is unoccupied as my material number to be created. Is ther any FM or codes?

    Dear,
    You can get this information from Tcode SNUM or you can access database table NRIV.

  • How to get resultset from oracle procedure use ejb3

    how to get resultset from oracle procedure use ejb3
    i know oracle procedure should like this
    Create or replace PROCEDURE resultset_test(
    aaa IN NUMBER,
    bbb OUT sys_refcursor) ....
    but what s the ejb3 scripts looks like? please give me an example or link~
    ths

    - there are no EJB3 scripts, only compiled application code
    - the part of the EJB spec that deals with databases is called the Java Persistence API, but likely you are just looking for the JDBC API.
    Now you should know what to Google to get your "example script": "java jdbc oracle procedure"

  • How to get photos from iphoto back onto an SD card. I have a MacBook Pro with a built in SC card slot.

    How to get photos from iPhoto back onto a SD card. I have a MacBook Pro with built in SD card slot. I have tried "Export" but this does not work.

    It's best to export the photos to a folder and then drag the folder onto the memory card.  Memory cards are usually formatted for PCs, FAT 32, which doesn't permit more than a limited number of files in the root directory. Putting the photos in a folder gets around that limitation.
    OT

  • How to get the 4 digit number associated with a SAP icon ( ICON_MAIL )

    Hi Friends,
                   Could anyone please tell me how to get the 4 digit number associated with a SAP icon ( ICON_MAIL ).
                   eg: - For ICON_GREEN_LIGHT the four digit id code is '@08@' (which you can get from ICON table )and the associated 4 digit number is'1003'.
                  Similarly I want to get the 4 digit number for ICON_MAIL(e-mail icon)
    <b><REMOVED BY MODERATOR></b>
    Ashiq
    Message was edited by:
            Alvaro Tejada Galindo

    You can use this report...It's not mine...
    REPORT zdummy_atg_2.
    TABLES: ICON.
    INCLUDE <ICON>.
    FIELD-SYMBOLS: <F>.
    SELECT * FROM ICON.
       ASSIGN (ICON-NAME) TO <F>.
       WRITE:   /(5) <F>, 20 '@',21 ICON-ID+1(2),23 '@',ICON-OLENG,
                ICON-BUTTON,ICON-STATUS,ICON-MESSAGE,ICON-FUNCTION,
                ICON-NAME.
    ENDSELECT.
    Greetings,
    Blag.

  • How to get a service notification number for given serial number

    Please, someones know how to get a service notification number based on serial number.
    In our process the notification can be created as first step (IW51) or can be created starting from service order (IW32).
    Thanks in advance.
    Luca

    Hi pooja,
    actually standard service request numbers are configured in spro->crm->transactions->Settings for Service Requests->Number Ranges. here they are maintain service request,incident,problem number ranges..
    so when ever your creating any service request then that number range will appear in that object id.
    you have to get that object id in your custom field get_method and based on that you have to change your number..
    example:
    current = me->bo.
    current->get_property_as_string( EXPORTING iv_attr_name  = 'OBJECTI_ID'  RECEIVING rv_result  = lv_id ).
    here you will get object_id based on that you have to write your own logic to display custom value.
    " write your custom logic to populate custom field. pass that custom field value into returning parameter.
    value = custom_value.
    Thanks & Regards,
    Srinivas.

  • How to get BOOLEAN from STORED FUNCTION

    We are calling legacy PLSQL stored procedures and functions via named queries. This has worked fine so far, but there are some functions which return the type 'BOOLEAN'. e.g.
    FUNCTION some_function( some_argument IN NUMBER) RETURN BOOLEAN;
    Where the return type is BOOLEAN calling the named query fails with
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    A couple of threads have hinted that what we are trying to do is not possible:
    How to get BOOLEAN from STORED PROCEDURES
    Re: Creating Named Query: from OracleCallableStatement
    This would possibly be due to 'restriction in the OCI layer'. Can anyone help? Is there really now way to call a valid PLSQL stored function via a named query when the return type is BOOLEAN?
    thanks

    I can't comment on possible issues you might have with the driver, but if it can be done in JDBC, it should be possible in TopLink.
    TopLink has the StoredFunctionCall which extends the StoredProcedureCall but adds an unnamed ouput parameter in the first spot of its parameter list. You will need to get the databasefield and set its type to BOOLEAN ie:
      DatabaseField returnField = (DatabaseField)yourStoredFunctionCall.getParameters().firstElement();
            returnField.setName(name);
            returnField.setSqlType(Type.BOOLEAN);Be sure not to use the setType() method, as I believe TopLink will try to use the Type.BIT when a boolean class is used as the classtype.
    Best Regards,
    Chris

Maybe you are looking for