Get current week dates

Hi I'm trying to put a query together that shows the dates, from monday to saturday for the current week. So for example if it's friday it has to show me monday / tuesday / wednesday / thursday and the current friday.
Does anyone know how to accomplisch this with the use of sysdate?
This is what I got now.
select trunc(trunc(sysdate,'y') + (:fw * 7),'iw') "Monday",
trunc(trunc(sysdate,'y') + (:fw * 7),'iw')+1 "Tuesday",
trunc(trunc(sysdate,'y') + (:fw * 7),'iw')+2 "Wednesday",
trunc(trunc(sysdate,'y') + (:fw * 7),'iw')+3 "Thursday",
trunc(trunc(sysdate,'y') + (:fw * 7),'iw')+4 "Friday"
from dual
but I need to get this in one column and that it wil automaticly fill in the current week date
Message was edited by:
SilvertraX

SQL> select to_char(next_day(sysdate,'sunday')-7+rn,'day')
  2  from
  3   (select rownum rn
  4    from dual
  5  connect by level <= (next_day(sysdate,'sunday') - sysdate)+1)
  6  /
TO_CHAR(N                                                                      
monday                                                                         
tuesday                                                                        
wednesday                                                                      
thursday                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • How to get current week data only

    Dear All,
    I'm running a report from January 2014 till date.
    I want a variable that helps me to show only the current week data.
    Please help ASAP if anyone available now.
    Thanks In Advance

    Hi
    You should create a dynamic prompt @ universe level or @ Business layes with @Prompt.
    create a filter in universe with below code
    DATE BETWEEN
    case
    when @Prompt('Week Start Date:','A','<LOV>',,'Week Start Date')='Week Start Date' then getdate()-7
    else @Prompt('Week Start Date:','A','<LOV>',,) end
    AND
    case
    when @Prompt('Enter Date:','A','<LOV>',,'Current Date')='Current Date' then getdate()
    else @Prompt('Enter Date:','A','<LOV>',,) end
    PS: syntax will work for SQL server. Change syntax for other databases
    Now use the filter in the report and you will get the current date data
    Regards
    Anil

  • Current week dates

    Hello
    Can anybody help me out in getting the current weeks dates. I know only know how to get todays date.
    Thanks
    Sravanti

    You can use the Calendar class to help you with getting dates:
    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.DAY_OF_WEEK, 0);
    Date[] thisWeek = new Date[7];
    for(int idx = 0; idx < 7; idx++)
      thisWeek[idx] = calendar.getTime();
      calendar.add(Calendar.DAY, 1);
    }It should be quite obvious what's going on in there.
    A new Calendar is created. By default it has the current date. We set it to be the first day of the current week. We then keep adding one day to it, storing the resultant Date (given by getTime()!).
    Hope this helps.

  • How to get current row data in table control

    Hi , expert ,
       I am professional in oracle ,  but  now I am a new guy in SAP ABAP .
    I  have a question in UI
    How to get current row data and click pushbutton  in table control  to open next screen ?
    I want to get the current data and open next screen to carry out detail detail .
    Thansk for all your suggestion .

    GET CURSOR LINE SY-CUROW .
      READ TABLE internal_table index SY-CUROW.

  • Getting previous weeks data based on parameters entered

    I am using CRXI. I have a RT that gives me the current week data but I need to be able to report on previous week data based on the paraments so if I enter dates between sunday and saturday of one week it will report on those data plus the same days of the previous week. I looked at the lastfullweek function, but not sure how to implement it in my scenerio. any ideas?
    Ralph

    That worked, thankyou. My next question along the same lines, is I am also having a third column that will indicate the percent change. for example
    Current             Previous              % Change
    97                    108
    I am trying to computer the % change between curent and previous basically it would look at previous as being the control and computer positive or negative based on what current is. I can do the math formulas, but I'm not sure what to comute to find the % change.
    Ralph

  • Calendar getting current week

    Hi,
    Is there a way to get the current week for a ceratin date.
    (e.g id i input today 17/06/2008, i must receive 15/06/2007 - 21/06/2007)
    if sunday is my first week day or 16/06/2007 - 22/06/2007 if monday is my first day of week.
    kindly advice how can this be done.
    Thank you in advance

    Thank you for your reply.
    But if i do not use the af:choosedate or af:selectinputdate.
    can this be done programatically, il will have on input to write the date and then i will display 2 output for the date of the first day of the week in question and the other for the last.
    Please advice

  • How to get current navigation data using C#

    Hi,
    Please help me to get the current navigation data using c#.
    In detail, In my sharepoint 2013 site, if i navigate to the Site Actions -> Settings ->Navigation -> Current Naviation and add some link it should show on my web part.
    I am trying to create  a new web part and this web part should show the content of Current Navigation (under settings).
    Thanks in advance.

    Hi Lakshmanan,
    Thanks for your reply.
    I need more CSS customization so i am looking for C# code and i got the code. i am getting all the subsites but child nodes of subsites are showing zero even though the subsites having another subsites and pages.
    I have tried the below scranario,
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.navigation.spnavigation.quicklaunch.aspx
    Please help me on this. This is very urgent for me.
    Thanks a ton.

  • Get current week of calendar

    Hi there,
    I want do get the number of the current week into a integer.
    my code:
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="java.util.*"%>
    Calendar calendar = Calendar.getInstance();
    int kw = calendar.WEEK_OF_YEAR;
    session.setAttribute( "show_kw", kw);
    session.setAttribute( "kw", kw); // please do not wonder...I need this, tooLater in my code I want to display this number:
    <p><%
              session.getAttribute("show_kw");
              %></p>But it displays...nothing. Not even a space.
    Any idea, why it isn't showing up the number?
    X--spYro--X

    You need to use the following :
    int kw = calendar.get(Calendar.WEEK_OF_YEAR);instead of
    int kw = calendar.WEEK_OF_YEAR;in your code.
    Hope this helps.
    Thanks

  • How to get current system date and store in db

    may i know how to get the current system date so that i can store it into the database

    java.util.Date is NOT deprecated, just most of its methods are.
    Use
    new java.sql.Date(System.currentTimeMillis());to get the current date. Note that the date in a client machine
    may differ from the clock of the server!
    BTW: java.sql.Date extends java.util.Date.
    Fritz

  • How to get Current week and No of Weeks for each quarter!!

    Hi,
    As a part of report development I have to derive Current week and No.of Weeks in Curreny Query. Based on these information I have to calculate Phased target (Calculated KYF).
    Phased target = (Target for Quarter / No of weeks in Current Quarter) X Current Week.
    We have to derive Current Quarter and Current week from  Customer Exit (From Invoice date, which is an entry by Users at report level).
    My questions are:
    1) We have to derive Two Restricted key figures (by Calweek)  for derving No of weeks for Currnet Quarter and Current week in Query level. Based on this info, we have to derive Calculated kef figure for Phased target.
    2) And the output is 6 (ex:- 132008) char length for Current week and we have to pick Week info only and we have to populate RKF created for Current week. How we can achieve this.
    3) Regarding the No of weeks per for current quarter, we are writing Customer exit to determine Quarter and no of weeks, but how to bring this info in query level.
    4) Is there any standard code available (SAP Exit) to find Current week and No of Weeks in Current quarter.
    Regards,
    Suresh Molli

    Hi Venkat Molli,
    Follow the below step for the doing the same:
    1. Create a customer exit variable on calweek.
    2. Restrict the created variable for respective info object.
    3. To Populate the data write code in CMOD.
         in enhancement function module: EXIT_SAPLRRS0_001 -> in Include ZXRSRU01 write the below code:
    WHEN '<variable name>'.
         IF i_step = 1.
          CLEAR l_s_range.
          CALL FUNCTION 'RSVAREXIT_0P_CWEEK'
            IMPORTING
              e_t_range = lt_week.
          READ TABLE lt_week INTO l_s_range1 INDEX 1.
          v_last_week = l_s_range1-low+4(2).
          v_last_week =  v_last_week - 1.
          l_s_range1-low+4(2) = v_last_week.
          l_s_range-low      =  l_s_range1-low.
          l_s_range-sign     = 'I'.
          l_s_range-opt      = 'EQ'.
          APPEND l_s_range TO e_t_range.
        ENDIF.
    4. Execute the report.
    I hope you can handle you issue now.
    Assign points if it is helpful.
    Regards,
    S P.

  • Beginner Question: Get current Week Number with Token API

    Is it possible to get the current week (1-52) with the token API?
    I searched the gwtokens.pdf for a suitable method, but haven't found
    something that fit my needs.
    Any idea/suggestion?
    Thank's in advance for your help.

    test wrote:
    > current week
    Use the windows api, or build in functions of the language you code in
    Tommy Mikkelsen
    IT Quality A/S, Denmark
    Novell Support Forums SYSOP / NKP
    Sorry, but no support through email
    Please join http://www.open-horizons.net

  • Wants get the week dates

    Hi guys,
    I wants to get the weeks when i give the nth week number.
    Eg:
    SQL>  select to_date(to_char(sysdate,'iw'),'DD'),to_date(to_char(sysdate,'iw')+6,'DD')from dual
      2  where to_char(sysdate,'iw') =21
      3  ;
    TO_DATE(T TO_DATE(T
    21-MAY-12 27-MAY-12But when i give 1 or 2 inplace of 21st i am not getting the results.
    Ok can i get without restricting my sysdate... ?
    Thans
    Edited by: san on May 24, 2012 5:04 PM

    You could create a view containing all weeks and start/enddates for the current year using a CONNECT BY query and
    select from that.
    Example:
    -- create a view containing all weeks for the current year
    create or replace view week_generator as
    select to_char(trunc(sysdate, 'yyyy')+level-1, 'iw') iweek
    ,      to_char(trunc(sysdate, 'yyyy')+level-1, 'dd-mm-yyyy') startdate
    ,      to_char(trunc(sysdate, 'yyyy')+level-1+6, 'dd-mm-yyyy') enddate
    from   dual
    connect by level <= last_day(add_months(trunc(sysdate, 'yyyy'), 11)) - trunc(sysdate, 'yyyy');
    -- query the view:
    select startdate
    ,      enddate
    from   week_generator
    where  iweek = 1;
    select startdate
    ,      enddate
    from   week_generator
    where  iweek = 21;Depending on your exact requirement, you may need to do some adjustments:
    SQL> select startdate
      2  ,      enddate
      3  from   week_generator
      4  where  iweek = 1;
    STARTDATE  ENDDATE
    02-01-2012 08-01-2012
    03-01-2012 09-01-2012
    04-01-2012 10-01-2012
    05-01-2012 11-01-2012
    06-01-2012 12-01-2012
    07-01-2012 13-01-2012
    08-01-2012 14-01-2012
    7 rows selected.
    SQL> select startdate
      2  ,      enddate
      3  from   week_generator
      4  where  iweek = 21;
    STARTDATE  ENDDATE
    21-05-2012 27-05-2012
    22-05-2012 28-05-2012
    23-05-2012 29-05-2012
    24-05-2012 30-05-2012
    25-05-2012 31-05-2012
    26-05-2012 01-06-2012
    27-05-2012 02-06-2012
    7 rows selected.

  • How can we get current time date with resultset?

    Dear All,
    I have to insert current time date in the table.So,i need to get the current time and date with result set.So,I will first get the time date and then insert it into the table.
    I know how can we get current time and date without resultset.i have created this function its working.But now i want to use this.mean using resultset i want to put in the table.
    How can i do this?
    public static String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
    public static String now() {
    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
    return sdf.format(cal.getTime());
    }

    yuck. Why not simply set a "new java.sql.Date()" to the SQL parameter in question?

  • Error using a binding to get current row data

    Hi, from a previous post ( Calling a stored procedure ) that has been answered i have reached to this point and cant get go on:
    i have a method declared on appmoduleimpl that calls to a procedure stored in the database and passes two parameters (one string, and one int)to the stored procedure.I drag and drop the method from the data control pallete to my jspx page.
    the problem is that i want to get the value of two rows from the current record and set them as values from the parameters.
    My Binding:
    ${bindings.Module3EmpIterator.currentRow.empno}
    ${bindings.Module3EmpIterator.currentRow.ename}
    Note: Module3Emp its the name of my view
    when i use this binding i get this error code
    JBO-29000: javax.servlet.jsp.el.ELException: Unable to find a value for "ename" in object of class "oracle.jbo.server.ViewRowImpl" using operator "."
    javax.servlet.jsp.el.ELException: Unable to find a value for "ename" in object of class "oracle.jbo.server.ViewRowImpl" using operator "."
    JBO-29000: javax.servlet.jsp.el.ELException: Unable to find a value for "ename" in object of class "oracle.jbo.server.ViewRowImpl" using operator "."
    javax.servlet.jsp.el.ELException: Unable to find a value for "ename" in object of class "oracle.jbo.server.ViewRowImpl" using operator "."
    JBO-29000: javax.servlet.jsp.el.ELException: Unable to find a value for "ename" in object of class "oracle.jbo.server.ViewRowImpl" using operator "."
    javax.servlet.jsp.el.ELException: Unable to find a value for "ename" in object of class "oracle.jbo.server.ViewRowImpl" using operator "."
    Thanks.

    Here i store a pl/sql code in a method (At AppModuleImpl Level)
    public void callProc1 (String ename,
    int empno)
    PreparedStatement plsqlBlock = null;
    // String statement = "BEGIN p_proc1(:1,:2); END;";
    String statement = "BEGIN INSERT INTO p_proc (ID, dato, numero) VALUES (s_proc.NEXTVAL, :1, :2); END;";
    plsqlBlock = getDBTransaction().createPreparedStatement(statement,0);
    try
    plsqlBlock.setString(1,ename);
    plsqlBlock.setInt(2,empno);
    plsqlBlock.execute();
    catch (SQLException sqlException)
    throw new SQLStmtException(CSMessageBundle.class,
    CSMessageBundle.EXC_SQL_EXECUTE_COMMAND,
    statement,
    sqlException);
    finally
    try
    plsqlBlock.close();
    catch (SQLException e)
    // We don't really care if this fails, so just print to the console
    e.printStackTrace();
    now i expose the method and set the variables in the page definition.
    <methodAction id="callProc1"
    InstanceName="Module3AppModuleDataControl.dataProvider"
    DataControl="Module3AppModuleDataControl"
    MethodName="callProc1" RequiresUpdateModel="true" Action="999"
    IsViewObjectMethod="false">
    <NamedData NDName="ename"
    NDValue="${bindings.Module3EmpIterator.currentRow.ename}"
    NDType="java.lang.String"/>
    <NamedData NDName="empno"
    NDValue="${bindings.Module3EmpIterator.currentRow.empno}"
    NDType="int"/>
    (that does it automatically when i drag and drop the method to the jspx page).
    This is the code in the command button inside the jspx page
    <af:commandButton actionListener="#{bindings.callProc1.execute}"
    text="callProc1"
    disabled="#{!bindings.callProc1.enabled}"/>
    When i click the button, the method should insert the selected column on a new table that i created But it doesn't. How i can do it, or how i can see the output of those values (bindings.Module3EmpIterator.currentRow.empno... etc.)
    Note: when i hardcode the values and put Hello instead of bindings.Module3EmpIterator.currentRow.empno it inserts into the table and works everything fine.

  • ADF: getting current week through sysdate

    hi,
    Im using Jdev 11G.
    i have a table with sysdate displaying.
    now i need to calculate week by this sysdate and display in another column of the table.
    for ex: if sysdate is 3/2/2012 then the week should be 09 (bcoz 2nd March 2012 is the 9th week for the year 2012).
    How can i achieve this.
    Thanks.

    Hi,
    Have you tried adding to_char(sysdate,'WW') as a new column (calculated) in your VO's query.
    Ex :
    select to_char(to_date('3/2/2012','mm/dd/yyyy'),'WW') from dual-Arun

Maybe you are looking for

  • Message Split or Split message in ABAP

    Hi ABAP guru, I am facing a difficult choise, our secnario like following: we will use a background job to trigger a program to collect today's new material master data, then use RFC adapter to send data to XI, XI will use JDBC receiver to insert dat

  • Caching service only works for OS X updates and not for Apps

    Hello, It seems that my OS X Server Caching service only works for Apple OS X Software Updates (in Mac App Store updates, when the icon of Mountain Lion appears). I see it in my logs in verbose mode when I download an Apple OS X Software Updates and

  • Do I need to get rid of duplicate libraries?

    Hi, I suspect I have a duplicate library of music and duplicates of songs taking up memory on my computer. I searched for a particular artist and found three versions of his songs in the following locations: usr> music> itunes> itunes media> music> a

  • What to do if my disk space is almost full

    I'm a photographer, and I have a lot of large photo files stored in my MacBook Pro. I import them into Adobe LightRoom, and a message keeps appearing after I close down LightRoom saying "Your startup disc is almost full," and that I need to delete fi

  • Re: Windows 7 Upgrade fulfillment discussion

    I posted a message and it magically disappeared.  Wow, the mods are doing a great job by censoring messages and I wish, really wish, that they worked in the fulfillment center so that we would all have got our supposedly "free" Windows 7 upgrades by