Finding Last friday and Last monday of current date

Hi
Please help me to get the Last friday and Last monday of current date using an sql query.
If I am running query on 7th July 2008 ,it should give me Last friday as 07/04/2008 and Last monday as 07/07/2008
I need to compare it with another date filed
eg: Select * from employee where ReportedDate between [Last Friday] and [Last Monday]

It works many times but fails for this scenario- If today is Friday and I run following query today, it throws today's date, which is incorrect. I need previous Friday's date to be returned everytime.
select next_day (sysdate-7,'FRIDAY') Last_Friday from dual
Edited by: user6402026 on May 22, 2013 1:43 PM
Edited by: user6402026 on May 22, 2013 1:43 PM

Similar Messages

  • Create prompt with date-filter and initialize it with current date

    Oracle BI 11 g
    Hi!
    I need to create dashboard prompt with date-filter and initialize it with current date. How can I do that?
    I tried to create repository initialization block and add variable. But I don't know what should I write to DataSource? I tried to use functions Now(), Current_Date, sysdate (for example, SELECT Now() FROM tbl_Calendar) but without results - when I pressed "Test..." button I got errors - something like "Now() is unknown function" or "Incorrect syntax near key word Current_Date".
    After that I tied to use Presentation Variable in Prompt, but also without success ((
    Please, help me.

    I've created Repository Variable "CurrentDate", using SQL-query like this "select convert(varchar(10), getdate(), 104)" and now this variable is being initialized by value "07.04.2011". But I don't understand how to use this varible in DashboardPrompt! What item in list "Default selection" I should choose - "Variable Expression", "Server Variable" or something else? When I chose "Variable Expression" and write "CurrentDate" I got just string "CurrentDate" when preview Prompt. @{CurrentDate} gave me the same result.

  • To find last inserted or updated date from an schema

    Hi,
    i need a query to find the list of tables which was last updated or inserted (upto 2003) from a schema..
    Rgds.

    Such information is nowhere stored , the only 'date' column in DBA_TABLES is 'LAST_ANALYZED'.
    Werner

  • How to find Table Name and Field Names given a Data Source

    Hi,
    I tried ROOSOURCE table in R/3 to find the Extract Structure and Extractor names for a specific data source, let us say 2LIS_02_ITM (PO Item Level).
    I know the extract structure for this data source is MCO2M_0ITM
    I am not able to find where this structure is extracting the data for every field.. I wanted to know the corresponding table name and the respective field names.. Both the existing and Appended fields..
    Thanks,
    Naren

    Hi,
    Check in in LBWE and Click on Maintenance and see the table names
    EKKO
    EKPA
    EKPO
    Tables are use for this DS
    Eg:
    MCEKKO  BEDAT  Document Date
    MCEKKO  BSART  Document Type
    MCEKKO  BSTYP  Doc. Category
    MCEKKO  BUDAT  Accounting date
    MCEKKO  EBELN  Purchasing Doc.
    MCEKKO  EKGRP  Purch. Group
    Note: here EKKO is table
    https://wiki.sdn.sap.com/wiki/display/BI/BW%20SD%20MM%20FI%20DATASOURCES
    thanks
    Reddy
    Edited by: Surendra Reddy on Mar 10, 2010 8:18 AM
    Edited by: Surendra Reddy on Mar 10, 2010 8:19 AM

  • Lost recovery key and need to retrieve current data

    Yeah.
    It's a really nasty situation.
    In order to get back into Sync i have to generate a new recovery key
    But the recovery key generator will mangle the synced data.
    Is there any way to retrieve the data?.
    I haven't been able to sync with Firefox on Android and few days ago my harddrive gave up so I had to reinstall windows.

    If you don't have a 2nd device connected to that Sync account so you can "pair" them, AND you don't have the Sync Key that was used to encrypt your data as it was being uploaded to the Sync servers, you data can't be recovered.
    Did the reinstallation of Windows save any of your old data files? <br />
    Like maybe the \roaming\''user''\app data\Mozilla\Profiles folderset?

  • Where do Date and Calendar get the current date?

    The server's time is correct, but my Java application is one hour fast... Why could that be?

    Maybe because Java has a different notion of "local time zone" than whatever you use to check the time.
    Try checking the local timezone that Java thinks is in effect and compare this with whatever the OS provides.
    A common case seems to be that Java has more up-to-date timezone data than the OS and Java is actually true.
    And: you could easily make a mistake by converting Date/Calendar/... around an mess up the timezone information (don't ask me how exactly, but I've seen it before).

  • Inclusion of new hierarchy and its effect on current data model

    Hi,
    We have a cube in production. In it we have certain infoobjects for which we
    are using hierarchies on the reports.
    In case, we create a new hierarchy on an infoobject which is used in the cube...what adjustments do we need to do to make this reflect during query design? Do existing queries get affected?
    Please help. Thanks
    Jason

    your existing queries wouldnt be affected. As you would have pointed to the hierarchy that was already there. If you need to point the query to the new hierarchy, you need to change the IO properties in the query to point the new one. Or if you want the users to have a choice to pick either one of the query, create a hierarchy variable to let them get the option.

  • Last 6 months of data from current date

    Hi Experts,
    I have a requirement in WebI to display last 6 months of data based on current date.Actually I have a column called "Employee Contract Start date" in my report.Suppose the end user executes the report today,then he should be able to see the Employee's data whose contract started today and in the last 6months from current date.
    Also I have dimension object name "Employee Contract Start Date".
    Please be noted that I am getting the data from Bex Query and I am working on BO 4.1 version.
    I have Objects "Calender day" , "Cal.year/Month" , "Calender month" , "Employee Contract Start Date" in the BEx Query.
    Could anyone please propose me, what are the ways to meet this requirement?

    Hi Cris,
    We can get the 6 Months date in webi.
    Check the below blog , will help you.
    http://scn.sap.com/community/businessobjects-web-intelligence/blog/2014/01/21/time-variablesdimensions
    Regards,
    Javed

  • Can a field be made to pull the current date from computer or internet and display it?

    Im making a form for someone and they want the current date of when the form is opened to be displayed at the top without having to type it in.  Is this possible?  I assume this has something to do with javascript but I dont know anything about that stuff

    Hi,
    I search something in the forum and found your message. If you need it once again, try this:
    var f = this.getField("currentDate");
    f.value = util.printd("dd.mm.yyyy",new Date());
    Or this one (helpful for Germans who want to display their date like this: 29. Juni 2010. If you take the first one in the dd. mmmm yyyy format, it shows you the month in English. 29. June 2010):
    var f = this.getField("currentDate");
    f.value = util.printd("date(de){DD. MMMM YYYY}", new Date(), true);

  • Wrote the current Date and Time in the backend

    HI everyone,
    I created a table view, where I display several records. Right now I will add an record to this table, which should be written back in the backend and automaticaly add the current date and time.
    But I don´t know to make this. I tried several time with the funktion  "now()", but it doesn´t work. So any help for me, to explain how I can display the actual time and then write it back to the backend?
    Thanks

    we use a crm system. but the BAPI I mentioned was
    just to play with. My basis will develop a new API
    for the project, that have the requested Inputfields.
    But what I tottaly forget was, that there has to be a
    field for the time, so thanks for the advice.
    No Problem.
    I´m still of the opinion , that it should be possible
    to add the curret time in a field with the
    funcionality of the VC, even there is a way to show a
    clock with the current time. My problem is that I
    can´t figuer out how to do this.
    Therefore you can use the TNow() function (Time functions) and the Now() Function (Date functions). You can cast them to a string and concatenate the string, then you have the date of today with the current time. This string you can format and transfer it as input for your BAPI_ADD_BP for example.
    Hope that helps.
    Best Regards,
    Marcel

  • Get  current date and time

    hello.
    How can I get current date and time in JAVA?
    Thanks.

    Sorry, I mean:
    how can I get the value of DATE, MONTH, and YEAR of the
    current date?
         Date date = new Date();
         System.out.println(date);

  • Find month and year of a given date

    Hi,
    How to find the month and year of a given date.
    month ( sy-datum)  year ( sy-datum )
    --Bala

    hi
    DATA: EDAYS LIKE VTBBEWE-ATAGE,
    EMONTHS LIKE VTBBEWE-ATAGE,
    EYEARS LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
    TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
    Call Function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
      exporting
        i_date_from          = FROMDATE
        i_date_to            = TODATE
      I_FLG_SEPARATE       = ' '
      IMPORTING
        E_DAYS               = EDAYS
        E_MONTHS             = EMONTHS
        E_YEARS              = EYEARS.
    WRITE:/ 'Difference in Days   ', EDAYS.
    WRITE:/ 'Difference in Months ', EMONTHS.
    WRITE:/ 'Difference in Years  ', EYEARS.
    INITIALIZATION.
    FROMDATE = SY-DATUM - 60.
    Using teh abiove u can get difference but when u pass previous year u wont get the exact.
    There is no seperate FM for this, u have to use three FM.
    If possible using these three FM code u can create an FM.
    For years and months between two days:
    DATA:   EYEARS  LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE PREL-BEGDA,
                     TODATE   LIKE PREL-BEGDA DEFAULT SY-DATUM.
    CALL FUNCTION 'COMPUTE_YEARS_BETWEEN_DATES'
      EXPORTING
        first_date                        = fromdate
      MODIFY_INTERVAL                   = ' '
        second_date                       = todate
    IMPORTING
       YEARS_BETWEEN_DATES               =  EYEARS
    EXCEPTIONS
      SEQUENCE_OF_DATES_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.
    Write:/ eyears.
    DATA:       EMONTHS LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE SY-DATUM,
                TODATE   LIKE SY-DATUM
    DEFAULT SY-DATUM.
    CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'
      EXPORTING
        i_datum_bis         = fromdate
        i_datum_von         = todate
      I_KZ_INCL_BIS       = ' '
    IMPORTING
       E_MONATE            = emonths
    write:/ emonths
    CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
    EXPORTING
    I_DATUM_BIS = x_faede-zfbdt
    I_DATUM_VON = p_fdat
    I_KZ_EXCL_VON = '0'
    I_KZ_INCL_BIS = '0'
    I_KZ_ULT_BIS = ' '
    I_KZ_ULT_VON = ' '
    I_STGMETH = '0'
    I_SZBMETH = '1'
    IMPORTING
    E_TAGE = dias_v.
    IF SY-SUBRC <> 0.
    ENDIF.
    x_faede-zfbdt -> 20050915
    p_fdat -> 20050811
    dias_v = 4
    try this and let me know.
    regards
    ravish
    <b>plz dont forget to reward useful points</b>

  • Current date in xslt mapping

    Hi,
    I've tried to get the current date in my xslt mapping.
    I've used the following xslt coding:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date">
    <xsl:template match="/">
    <xsl:variable name="now" select="current-date()"/>
    </xsl:template>
    </xsl:stylesheet>
    In stylus studio everything is OK and i retrieve the current date.
    When i import the xslt in the mapping tool and test the mapping i get the following error:
    javax.xml.transform.TransformerException: com.sap.engine.lib.xml.util.NestedException: Function with name 'current-date' not found in context library. at com.sap.engine.lib.jaxp.TransformerImpl.transform(TransformerImpl.java:251)
    While directly using the current date functionality within the message mapping everything is OK too.
    Does anyone know which date-functionality is used within the message mapping within the Integration Builder and/or wich mapping to be used in xslt for a working scenario?
    Thnx in advance!

    Ok thnx, these anwers where very helpfull for me to solve this problem.
    I've awarded points for all your answers.
    For anyone interested later on, I needed the date in my XSLT mapping in the following format ddMMMyy.
    Finnally I used the following xslt to achieve this:
         <xsl:template name="currentDate" xmlns:cal="java:java.util.GregorianCalendar">
              <xsl:variable name="now" select="cal:getInstance()" />
              <xsl:variable name="day" select="cal:get($now, 5)" />
              <xsl:variable name="month" select="cal:get($now, 2) + 1" />
              <xsl:variable name="year" select="substring(string(cal:get($now, 1)), 3, 2)" />
              <xsl:variable name="month">
                   <xsl:choose>
                        <xsl:when test="$month=1">Jan</xsl:when>
                        <xsl:when test="$month=2">Feb</xsl:when>
                        <xsl:when test="$month=3">Mar</xsl:when>
                        <xsl:when test="$month=4">Apr</xsl:when>
                        <xsl:when test="$month=5">May</xsl:when>
                        <xsl:when test="$month=6">Jun</xsl:when>
                        <xsl:when test="$month=7">Jul</xsl:when>
                        <xsl:when test="$month=8">Aug</xsl:when>
                        <xsl:when test="$month=9">Sep</xsl:when>
                        <xsl:when test="$month=10">Oct</xsl:when>
                        <xsl:when test="$month=11">Nov</xsl:when>
                        <xsl:when test="$month=12">Dec</xsl:when>
                        <xsl:otherwise>INVALID MONTH</xsl:otherwise>
                   </xsl:choose>
              </xsl:variable>
              <xsl:choose>
                   <xsl:when test="$day &lt; 10">
                        <xsl:value-of select="concat(concat(concat('0',$day), $month), $year)"/>
                   </xsl:when>
                   <xsl:otherwise>
                        <xsl:value-of select="concat(concat($day, $month), $year)"/>
                   </xsl:otherwise>
              </xsl:choose>
         </xsl:template>

  • Best Approach to Compare Current Data to New Data in a Record.

    Which is the best approach in comparing current data to new data for every single record before making updates?
    What I have is a table with 5,000 records that need to be updated every week with data from a data feed, but I dont want to update every single record week after week. I want to update only records with different data.
    I can think of these options:
    1) two cursors (one for current data and one for new)
    2) one cursor for new data and one varray for current data
    3) one cursor for new data and a select into for current data.
    Thanks for your help.

    I don't recommend it over merge, but in theory you could use a checksum (OWA_OPT_LOCK.checksum()) on the rows and if they differ then copy the new row into the destination table. Or you might be able to use rowscn to see if things have changed.
    Like I said, I don't know that I 'd take either approach over merge, but they are options.
    Gaff
    Edited by: Gaff on Feb 11, 2009 3:25 PM
    Actually, rowscn between 2 tables may not be an option. I know you can turn a rowscn into a time value so if that rowscn is derived from anything but the column values for the row that would foil that approach.

  • I have iphone 3gs and last days i made upgrade 5.01, but i dont know that this version is not avaliable in brasil yet. than my iphone 3gs 32 gb no more find the wide and it be seaching the sinal. what i need to do to back to before situation. thanks a lo

    i have iphone 3gs and last days i made upgrade 5.01, but i dont know that this version is not avaliable in brasil yet. than my iphone 3gs 32 gb no more find the wide and it be seaching the sinal. what i need to do to back to before situation. thanks a lot

    iOS 5.0.1 has been out for a couple months, if not longer. 
    There was no delay in releasing it in any country.
    So what is your issue? 

Maybe you are looking for

  • Open return orders in sd module

    hi all, can any one explain me wht are open return orders in sd module and also credit memo issued for opem return order and goods receipt processed against the delivery. if possible can u explain me with example.                                     

  • Hp laserjet p100 slow printing!

    good day...i have a printer laserjet p100...and it seems it was so slow in printing, specially when ur printing multiple pages, when i print 70 pages...ill wait for about 15mins before the printer works...any one can give a help? tnx.

  • Downloading movies help it takes soooooo long

    I'm having a problem with my iPod touch 4 th generation. I try and download a movie from iTunes and it takes forever....like hours....is this normal??

  • How To upload a infotype via BDC recording

    Hi , I am looking to do a BDC recording to upload a infotype which is 105 for communications My office head quarters are moving so they are changing the first 6 digits of the tlefone numbers but the extensions will remain the same so how is this poss

  • Can I get a list of all devices registered for Messages?

    Is there a way to find out which devices have registered for Messages with my phone# or Apple ID? With 10.9 it seems that as soon as I log into a new mac this machine registers itself for messages, and I got a message last night that a new device had