Difference Between 2 dates using variables in ODI

Hi,
I have 3 variables in ODI,
Start Date, End Date and Duration.
Start Date - Alphanumeric -  select TO_CHAR(SYSDATE,'DD-MM-YYYY HH24:MI:SS') FROM DUAL
End Date - Alphanumeriic - select TO_CHAR(SYSDATE,'DD-MM-YYYY HH24:MI:SS') FROM DUAL
Duration - Alphanumeric - select to_date(#Start_date, 'DD-MM-YYYY HH24:MI:SS') - to_date(#END_date, 'DD-MM-YYYY HH24:MI:SS') FROM DUAL
It says invalid character.
Please let me know how can I find the difference of the start date and end date as duration

Have you tried
select to_date('#Start_date', 'DD-MM-YYYY HH24:MI:SS') - to_date('#END_date', 'DD-MM-YYYY HH24:MI:SS') FROM DUAL
Cheers
John

Similar Messages

  • Difference between two dates, using Variables in reporting

    how to calculate the days difference between Delivery date and Billing date in reporting, using variables (SAP BW 3.5v)?

    Hi,
    If you want to do the arethmatioc operations with the date then you will have to declare the date as key figure in the cube and add it there and then update it with the date from R/3.
    You can use formula variable for this subtraction.
    Create a formula in the bex analyzer and then in the down you will get option for the formula varibale.Just make a replacement path varibale on this time characteristic for which yuou want subtraction.
    During creation use "key" in the display and "number" as the data type.
    If number is not working them you can use "date" type.
    Nothing alse needs to be done during the variable creation.
    Once you have made the formula inlcude it in the columns of the report.
    Thanks

  • Calculating difference between two dates in Variable Exits

    Hi,
          I need to calculate the difference between the two dates in months in Variable exits. I want the result in months so that I need to find out the Average Usage.
            How can I find the difference between them in months.
    Thanks
    Dave.

    Hi Christophe, Senthil
                                       Sorry for late response, I checked this  MONTHS_BETWEEN_TWO_DATES_NEW  in SE37/SE38 and about the date they are going to enter at query run time it should be like 03/03/2006 to 08/03/2006 and I should get in 5 months and or if the date range 03/15/2006 to 08/03/2006 and I should get like 4.5 months. Please could you tell me how to get the values in months or please give me a functional module so that I can use.
    Thanks
    Dave.

  • Difference between uploading data using BDC,CATT

    Dear experts,
    what is the difference between uploading the data using BDC and CATT tool?
    is it only the coding or something else.
    and can you explain the situations where we prefer to upload the data using CATT tool.
    thanks in advance.

    Check this thread -
    Differences between  BDC , LSMW, BAPI,CATT
    Regards,
    Amit

  • Date Difference between to date formula variable

    Hi Expert,
                    I have create two formula variable one for Document Date and another one for Goods reciept date
    and through formula variable I am subtracting these two formula variable and getting the no. of days between
    document date and GR date.
    This Shows me the correct value for one document date because i am filtering my query according to document
    date,
    while i am giving the date range for document date is shows me incorrect result. bucause document date formula
    variable contains only one date.
    Eg. i am giving the document date range like 01.02.2010 - 28.02.2010.
          In document date formula variable it contains only 01.02..2010 and GR date formula variable it contain correct
    value, thats why the date difference is incorrect because those PO which has PO date like 12.02.2010 for that Doc
    formula variable bring the same date like 01.02.2010.
    Please tell me the solution
    Thanks and Regards
    Lalit Kumar

    Hi Expert,
                     Actually i have created two formula variable on for PO date and another for GR date
    and i've restrict the query through PO date.
    while i am taking the single PO date in Selection parameter it showing me correct difference
    eg: Selection Parameter for PO: 01.01.2010
    But while i am taking the date interval for PO date
    eg: 01.01.2010-30.01.2010
    PO No: XXXXX123 , Doc date: 01.01.2010 GR date: 7.01.2010 then date difference is : 6
    PO No: XXXXX432, Doc date: 03.01.2010 GR date: 8.01.2010 then date difference is : 7 but it is 5
    Thanks and Regards
    Lalit Kumar

  • Difference between two date in bex query

    Hi all,
    I need to do a difference between two date using formula variable processing type customer exit beaucause I must use factory calendar in the formula.
    How can I do it?
    Can you give me an example of the routine?
    Thanks a lot
    Gianmarco

    Hi,
    You can still use the same code to copy it and customize as per your need. All you need to do is to subract the dates using the class: CL_ABAP_TSTMP after converting to timestamp and resulting seconds you convert back to days....Please get help from the developers to do this...
    Also, ensure that you write back this difference value to your variable so you get it on the reports for your calculations...
    Cheers,
    Emmanuel.

  • Difference between Temp table and Variable table and which one is better performance wise?

    Hello,
    Anyone could you explain What is difference between Temp Table (#, ##) and Variable table (DECLARE @V TABLE (EMP_ID INT)) ?
    Which one is recommended to use for better performance?
    also Is it possible to create CLUSTER and NONCLUSTER Index on Variable table?
    In my case: 1-2 days transactional data are more than 3-4 Millions. I tried using both # and table variable and found table variable is faster.
    Is that Table variable using Memory or Disk space?
    Thanks Shiven:) If Answer is Helpful, Please Vote

    Check following link to see differences b/w TempTable & TableVariable: http://sqlwithmanoj.com/2010/05/15/temporary-tables-vs-table-variables/
    TempTables & TableVariables both use memory & tempDB in similar manner, check this blog post: http://sqlwithmanoj.com/2010/07/20/table-variables-are-not-stored-in-memory-but-in-tempdb/
    Performance wise if you are dealing with millions of records then TempTable is ideal, as you can create explicit indexes on top of them. But if there are less records then TableVariables are good suited.
    On Tables Variable explicit index are not allowed, if you define a PK column, then a Clustered Index will be created automatically.
    But it also depends upon specific scenarios you are dealing with , can you share it?
    ~manoj | email: http://scr.im/m22g
    http://sqlwithmanoj.wordpress.com
    MCCA 2011 | My FB Page

  • Difference between two dates

    Hi
    I have two date fields in the ODS..Both are characterists
    1. Requested delivery date
    2. Actual shipment end date.
    I would like to create a calculated KF  field for the difference between two dates in a query.
    How can I accomplish it?
    Regards

    You have to make Expiration data as nav attribute and create a formula variable then only this date can be used in calculations.
    refer this How to...for the same
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/72f4a790-0201-0010-5b89-a42a32223ffc
    later you can try to calculate difference between dates!
    Re: calculating the difference between two dates
    Please search in forum with 'difference between two dates'.You will find lots of good posts on this issue!
    hope this helps
    Regards

  • Difference between 2 dates in milliseconds

    Hi all,
    I need to create a timestamp of difference in milliseconds
    between the date and time now and 00:00:00 01/01/1970.
    I am currently using:
    <cfset timeStamp = dateDiff("s",
    createDateTime(1970,01,01,00,00,00), REQUEST.dateTimeNow)*1000>
    but that gives me a value of 1.170170719E+012; however I
    require a string containing 13 numeric characters.
    Any advice appreciated.
    Thanks,
    Paul

    Paul / Adam,
    Thank you for your replies.
    > The DIFFERENCE between two dates is *not* a timestamp.
    It is just a value.
    > I presume what you want is the NUMBER of milliseconds
    since 0:00 1/1/1970.
    Yes, that is true. I am integrating the HSBC card payment
    interface and the name of the variable they are requesting is
    "timeStamp". I must have just used that as a description of what I
    was after rather than just the name.
    > "Determines the integer number of units by which date1
    is less than date2".
    >
    > dateDiff() will not do units of milliseconds, but it
    will do seconds. And
    > there's 1000ms in a second.
    So <cfset timeStamp = dateDiff("s",
    createDateTime(1970,01,01,00,00,00), REQUEST.dateTimeNow)*1000>
    should tell me how many seconds there are between 00:00:00 on
    01/01/1970 and the current date and time, then the *1000 should
    tell me the value in milliseconds?
    I have spoken with HSBC and they tell me that the specific
    value they are looking for from the timestamp is 13 numerical
    characters (e.g. 1170185487375), but the value being returned from
    my cfset above is 1.170170719E+012, which includes non numerical
    characters.
    The HSBC payment server is on a Linux server and my host is
    Windows. Are there any differences in the formatting of such a
    string?
    I cannot see anything I have missed on this.
    Any other suggestions?
    Thanks,
    Paul

  • Difference between two dates into server behaviors

    Good morning all,
    I'm trying to create a recordset using server behaviors and as I'm not an expert using php I'm completely lost...
    The problem is the following : I want to find into a table all the records where the difference between today date and their creation date (stored in that table of course) is greater than, let's say 30days. How can I indicate that into the variables field ?
    Many thanks in advance for your help !

    Many thanks !
    I was ignoring the DATE_SUB function and it does work in such a simple way… (with a closing parenthesis at the end)
    Thanks again !
    Best regards
    De : osgood_ [email protected]
    Envoyé : lundi 16 septembre 2013 15:59
    À : Berurier75
    Objet : Difference between two dates into server behaviors
    Re: Difference between two dates into server behaviors
    created by osgood_ <http://forums.adobe.com/people/osgood_>  in Dreamweaver support forum - View the full discussion <http://forums.adobe.com/message/5685549#5685549

  • Difference between 2 dates in form of years,months and days.

    Hi friends,
      i need one function module for finding difference between 2 dates and the output is
    no. of years
    no.of months
    no. of days.
    it means the input is begin date and end date
    output is no.of years,no.of months and no.of days.
    for example begin date is today i.e., 08/02/2008 (dd/mm/yyyy) and end date is 07/03/2008 then the output is
    no.of years -
      0,
    no.of months----
      1,
    no.of days----
      0.
    and one more example if begin date 08/02/2008
    (dd/mm/yyyy) and end date is 01/02/2008 then the output is
    no.of years -
    0,
    no.of months----
      0,
    no.of days----
    -7..
    Please help me it's very urgent

    Hi,
    Use FM HR_AUPBS_MONTH_DAY.
    It Calculate the years, months, days & cal days between 2 dates.
    Hi,
    The FM is 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
    Check the following example:
    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.
    Also You can write your own function module for this..
    just extract day and month and year from the two dates and then get the difference.
    suppose date 1 - y1m1d1
    date 2 = y2m2d2
    data : y1(2) type n,
    m1(2) type n,
    d1(2) type n,
    y2(2) type n,
    m2(2) type n,
    d2(2) type n,
    y1 = date1(4).
    m1 = date1+4(2).
    d1 = date1+6(2).
    y2 = date2(4).
    m2 = date2+4(2).
    d2 = date2+6(2).
    then get the differnce between years and days and months and store them in ur variables
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • Calculating the difference between 2 dates that ristrict 0CALDAY

    Hello.
    Is there an oppotunity to calculate the difference between 2 dates, that restrict the characteristic 0CALDAY.
    If i make the formula with
    1. type - replacement path
    2. interval use - difference
    than the difference could be calculated wrong(example 20070301 and 20070101 - result 201)
    Is there another way do solve the problem?
    Best regards,
    Andrey

    Hi,
    as you said, you need to create 2 formula variables.Both of them should have Replacement path as the preocessing type. And then use a formula to do the difference above 2 formula varibles.
    Now check these settings for both variables:
    <b>Replacement Path</b>
    Replace Variable with: <b>Key</b>
    For Intervals Use: <b>From Value</b>
    <b>Currencies and Units</b>
    Dimension ID: <b>Date</b>
    Then it should work
    Another link:
    http://help.sap.com/saphelp_nw04s/helpdata/en/03/6ba03cc24efd1de10000000a114084/frameset.htm
    regards
    marc
    assign points if it helped

  • As to the data type of the data type of the difference between two date type of datas

    Hi,
    I have a question about the data type of the difference between two date type of datas.
    There are two date type of datas as:
    SSHIPMENTS.RECEIVEDATETIME
    SSHIPMENTS.PROMISEDATETIME
    I try to use the following SQL Script in Oracle SQL*Plus as:
    SELECT CASE
    WHEN (SSHIPMENTS.RECEIVEDATETIME - SSHIPMENTS.PROMISEDATETIME) < '000 01:00:00.000' THEN 'OnTime'
    WHEN (SSHIPMENTS.RECEIVEDATETIME - SSHIPMENTS.PROMISEDATETIME) < '000 01:30:00.000' THEN '60-89 Minutes'
    ELSE '3+ Hours'
    END
    FROM SSHIPMENTS;
    The error message of "Invalid Number" for the '000 01:30:00.000' happens.
    I don't know if the data type of the interval is wrong.
    Many Thanks,
    Cathy

    SELECT CASE
    WHEN (to_char(SSHIPMENTS.RECEIVEDATETIME,'hhmiss') - to_char(SSHIPMENTS.PROMISEDATETIME,'hh24miss')) < '010000' THEN 'OnTime'
    WHEN (to_char(SSHIPMENTS.RECEIVEDATETIME,'hhmiss') - to_char(SSHIPMENTS.PROMISEDATETIME,'hh24miss'))< '000 01:30:00.000' THEN '60-89 Minutes'
    ELSE '3+ Hours'
    END
    FROM SSHIPMENTS;
    just try it out..

  • Difference between doc date,posting date and invoice date

    hi bw guys
    can someone give a brief on the difference between doc date,posting date and invoice date.and the invidual definitions
    thank you

    Hi,
    Posting Date: Date which is used when entering the document in Financial Accounting or Controlling. The posting date can differ from both the entry date and the doc date.
    Document Date: The document date is the date on which the original document was issued. Ex: Inv date, Bill date etc.,
    Invoice Date : Usually the date when goods are shipped. Payment dates are set relative to the invoice date.
    -Vikram

  • Difference between Posting Date & Baseline date in MIRO

    HI,
    What is the difference between Posting Date & Baseline date in MIRO?
    Regards
    Chandan
    Edited by: Chandan H N on Dec 14, 2009 11:11 AM

    Dear,
    Posting Date:
    Posting Date in the Document
    Date which is used when entering the document in Financial Accounting or Controlling.
    Use
    The fiscal year and the period for which an update of the accounts specified in the document or cost elements is made, are derived from the posting date.
    When entering documents, the system checks whether the posting date entered is allowed by means of the posting period permitted.
    Note
    The posting date can differ from both the entry date (day of entry into the system) and the document date (day of creation of the original document).
    Baseline Date
    Baseline Date for Due Date Calculation
    Date to which the periods for the cash discount deadline and the due date for net payment refer. This is the case for line items in open item accounts.
    For line items in G/L accounts, the item is due immediately on this date because there are no cash discount specifications.
    Procedure
    During document entry for open item accounts, the date may be defaulted. For this, a terms of payment key must have been specified in the customer's/vendor's master record for which a default value is requested in the document.
    The proposed date can be overwritten.
    If the cash discount rates (and days) have not been entered, the baseline date for payment is the same as the due date.
    Regards
    Utsav

Maybe you are looking for

  • NAT outside to inside and inside to outside (in 8.4(2) version)

    Thanks a lot and i attached a diagram here Requirement: need to pass through traffic from outside to inside and inside to outside. I also attached a diagram with the ip  and also tell me one thing that natting is only for private to public or public

  • How to call View of Component A from Compoenent B

    Hi Friends,          I have a requirment like: There are four views in component A and i want to use view2 of Component A in Component B. Can some one tell me how to work out. Note: All four views are assigned to one window only. Thanks in Advance Re

  • BPM composer - issue project

    Hi Experts, We have problems with create projects in BPM composer. Our configuration is : Server Admin      weblogic Server 10.3.6.4 - Binaries      SOA Suite 11.1.1.7 - Binaries Server Managed      weblogic Server 10.3.6.4 - Binaries      SOA Suite

  • My ipad wont play on Air play..since i updated ios 6.

    hi there... I updated to ios 6 and now it will not play using my Apple TV. It will still mirror on the TV but i cant play movies.???

  • How to config in this architecture to achive load balance?

    We have a XI which has a dialog instance.now we use the XI to connect to R3 system using abap proxy and to a no-sap system using JDBC. no-sap sys(DB2)->JDBC adapter<-xi(CI+Di)->r3 The question is how to achive load balance,using web-dispatcher or oth