Difference between 2 dates using variables in ODI

Hello

I have 3 variables in ODI

Start date, end Date and duration.

Start - alphanumeric characters - 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 characters - 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 and end time date date

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

See you soon

John

Tags: Business Intelligence

Similar Questions

  • Difference between 2 dates using PHP

    Hello

    Having some problems with the calculation of the difference between 2 dates.

    I noticed that about half of the results output 552 months... where is should be approximately 24 months...

    I also noticed that records that display this incorrect calculation having the month following the date less than the current month, it fixed $date2 as 01/01/1970

    This is the code:

    <? PHP

    Calculate the remaining months

    $date1 = date('d/m/Y');

    $date2 = $renewal_row ["enddate"];

    $date2 = date (a/m/Y ", strtotime (str_replace ('. ', ' ' ', $renewal_row [' enddate ']', $renewal_row ['enddate']))");

    $diff = abs (strtotime ($date2) - strtotime ($date1));

    $years = floor ($diff / (365 * 60 * 60 * 24));

    $months = floor (($diff-$years * 365 * 60 * 60 * 24) / (30 * 60 * 60 * 24));

    $days = floor (($diff-$years * 365 * 60 * 60 * 24-$months * 30 * 60 * 60 * 24) / (60 * 60 * 24));

    printf ("%d years, %d months, %d days\n", $years, $months, $days);

    $months_remaining = ($years * 12) + $months;

    ? >

    <? PHP echo "$date1 ='.strtotime ($date1).» ('. $date1.) ") date2 = '.strtotime ($date2).' ('. $date2.) ('') = Difference'. $diff;? >

    The date correct difference between these dates:

    $date1 = 1452038400 (06/01/2016) date2 = 1520035200 (03/03/2018) difference = 67996800

    Day with incorrect difference:

    $date1 = 1452038400 (06/01/2016) date2 = 1452038400 difference =(20/11/2016)

    Note that if the $date2 month exceeds the month current (June) it messes up.

    Any help would be appreciated!

    Assuming that this ["enddate"] $renewal_row is stored in a MySQL/MariaDB DATE, DATETIME, or TIMESTAMP column.

    $now = new DateTime();

    $end = new DateTime ($renewal_row ['enddate']);

    $time_remaining = $now-> diff ($end);

    echo $time_remaining-> format (' %m month %d days ");

  • differences between the Data Pump to back up the database and use RMAN?

    What are the differences between the Data Pump to back up the database and use RMAN? What is DISADVANTAGES and BENEFITS?

    Thank you

    Search for the backup of the database in

    http://docs.Oracle.com/CD/B28359_01/server.111/b28318/backrec.htm#i1007289

    In brief

    RMAN-> physical backup. (copies of the physical database files)

    DataPump-> logical backup. (logical data such as tables, procedures)

    Docs for RMAN-

    http://docs.Oracle.com/CD/B28359_01/backup.111/b28270/rcmcncpt.htm#

    Datapump docs

    http://docs.Oracle.com/CD/B19306_01/server.102/b14215/dp_overview.htm

    Published by: Sunny kichloo on July 5, 2012 06:55

  • How do the time difference between two dates?

    Hi all

    I use this query to get the time difference between two dates.

    Select to_timestamp ('2012-10-03 12:00 ',' YYYY-MM-DD hh)-to_timestamp ('2012-10-03 11:00 ',' YYYY-MM-DD hh) as double diff;

    but do not get the correct result.

    Thank you

    Left KEY... Left Padding of tanks.

  • How to find the difference between two dates in the presentation layer

    Hi gurus,

    Hello to everyone. Today, I came with the new requirement.


    I need to know the difference between a date and the current date in the formula column application presentation layer.by.



    Thank you and best regards,
    Prates

    Hi Navin,

    TIMESTAMPDIFF function first determines the timestamp component that corresponds to the specified interval setting. For example, SQL_TSI_DAY corresponds to the day component and SQL_TSI_MONTH corresponds to the component "month".

    If you want to display the difference between two dates in days using SQL_TSI_DAY, unlike butterflies SQL_TSI_MONTH and so on...

    hope you understand...

    Award points and to close the debate, if your question is answered.

    See you soon,.
    Aravind

  • How to calculate the difference between a Date column and the Date yesterday in the analysis (in the formula in the column)

    . For example, I need to calculate the difference between a date column, 'Table_Name '. "' Column_Name ' and (Current_Date-1). I tried different ways to do this. But nothing seems to work.

    Try the below formula.

    Replace "Time". "" Date "with your column.

    TIMESTAMPDIFF (SQL_TSI_DAY, "Time". "Date", TIMESTAMPADD (SQL_TSI_DAY-1, CURRENT_DATE))

    Thank you!

  • difference between two dates in the year/month/day in Obiee

    Hi gurus,

    I know this question have been asked and answered several times but I have a requirement that is a little different, then the previous ones.

    I want to calculate the difference between two dates in OBIEE10g in year/month/day format similar to the below SQL output

    SQL > select end_date, start_date,

    trunc (months_between (end_date, start_date) / 12) years.

    months of mod (trunc (months_between (end_date, start_date)), 12).

    End_date - add_months (start_date, trunc (months_between (end_date, start_date))) days

    t

    Thanks in advance

    SK

    Search for this

    "TIMESTAMPDIFF IN THE FORM OF MTHS # YEARS."

    or else

    To get the current mandate of employees since the date of hiring in the form of # years # mths or # year (s) # month (s)

    Concat (concat (cast (TIMESTAMPDIFF (SQL_TSI_Month, "Employee attributes". (((' ' Hiring last Date employee ", CURRENT_DATE) / 12 as char),"Year (s)"), concat (cast (MOD (TIMESTAMPDIFF (SQL_TSI_Month,"Employee attributes". (((((' ' Hiring last Date employee ", CURRENT_DATE), 12) as char), 'Month (s)'))

    Concat (concat (CAST (TIMESTAMPDIFF (SQL_TSI_YEAR, "Employee attributes". (((' ' Hiring last Date employee ", CURRENT_DATE) as CHAR),"Year (s)"), concat (cast (MOD (TIMESTAMPDIFF (SQL_TSI_Month,"Employee attributes". (((((' ' Hiring last Date employee ", CURRENT_DATE), 12) as char), 'Mth (s)'))

  • difference between 2 dates

    Hello experts,

    is it possible to get 'normal' date format then tell you the difference between two dates?

    For example, I first_unit_start_date (2012.02.17 13:57) and a last_unit_completion_date (2012.02.20 07:23). is it possible to get the calculation answer 17:26?

    Now, I found the only way to get minutes with calculation ROUND (1440 * (last date start date and end-first unit), 2)

    Thanx

    Hello

    You may be able to do by creating a date where the time part holds the difference. Something like:

    To_char (trunc (sysdate) + (last_unit_start_date - first_unit_start_date), "HH24")

    Rod West

  • How to know the difference between the Dates in Oracle.

    Hello

    Suppose we have two Dates say November 5, 2005 and October 12, 2007.

    Is it possible to know the total difference between these Dates in Oracle.

    Thank you

    You can subtract date-objects. The result is the difference in days.

    select  to_date('12-10-2007','DD-MM-YYYY') -  to_date('05-11-2005','DD-MM-YYYY')   from dual;
    

    In your example: 706 days

    Published by: hm on 25.10.2010 12:33

    Please look also for "Oracle Date arithmetic" in the Oracle Documentation or Google.

  • Find the difference between two date and time

    Hi friends,

    I wanted to find the difference between two date and time, but my qury is slightest error "invalid number."

    select sql_step_num,proc_name,run_seqno,start_date,end_date,(to_char(start_date,'HH24-MI-SS') - to_char(end_date,'HH24-MI-SS') ) as ed  
    from eval.EVAL_RUNTIME_DETAILS
    where trunc(start_date) = trunc(sysdate) 
    order by sql_step_num;

    You try to get the feel between two char strings.
    And more difference between two dates gives a NUMBER of days.
    Try this:

    select sql_step_num,proc_name,run_seqno,start_date,end_date,numtodsinterval(end_date-start_date,'DAY') as ed
    from eval.EVAL_RUNTIME_DETAILS
    where trunc(start_date) = trunc(sysdate)
    order by sql_step_num;
    
  • Calculation of the difference between the dates.

    All,
    I have a requirement where I need to calculate the difference between the dates. If the given date is less than the current date, it should return '0' (zero) other wise should return 1. How can I do this?

    Kind regards
    Vinciane

    and with a CASE statement...

    SQL> ed
    Wrote file afiedt.buf
    
      1  select case when to_date('01/11/2008','DD/MM/YYYY') /
    
      DATECOMP
    ----------
             0
    
    SQL>
    
  • Difference between two dates in the server behaviors

    Hello all,.

    I am trying to create a Recordset by using server behaviors and that I'm not an expert in php, I'm completely lost...

    The problem is this: I want to find in a table of all the records where the difference between today's date and date of creation (stored in this table, although course) is superior to, say 30 days. How can I specify the variable field?

    Thank you very much in advance for your help!

    You must use a sql like query below:

    SELECT * FROM table WHERE creationDate< date_sub(now(),="" interval="" 30="">

    'table' is the name of the table that you want to select the information of and 'creationDate' being the column 'date' in the database

  • How to tell the difference between two dates

    Hello:

    I have a question on how to get the difference in quantities for two dates in the replies and dashboard.

    This is the scenario. I have two guests date and three columns. The first column must be the sum of the amounts for the first quick date. The second column should be the sum of the amounts for the second fast date. And the third column is the difference between the first two columns.

    Basically, I'm trying to do something similar to a function of sum of two lines but trying to get the difference between the two rows. Any help to solve this problem would be appreciated.

    Use the COLUMN FILTERS level...

    the first column with the first variable of date quick presentation of the filter

    Similarly, the second column in the second variable of quick overview of date filter

    Kind regards
    Rambeau

  • Difference between available and used space

    Dear team,

    can someone please explain to me the difference between the provision and the disk space used in simple words.

    concerning

    Mr. VMware

    The summary above capacity data store is interpreted as follows: -.

    The capacity is the total size.

    Put into service space is the total size allocated to virtual machines.

    Free space is the space not exhausted by VMs again.

    Therefore, with a provisioning, you can provision the amount of space to virtual machines based on the free space at the time there. A virtual machine can be allocated to 100 GB but only use 50 GB. The unused 50 GB remaining is counted as part of the free space. This can be seen also by clicking on the tab "Virtual Machines" of the data store to see the "put into service space' and 'space used '.

    I hope this helps.

  • Difference between two dates

    Hello

    I have two columns both of them date data types.

    I would like to know the difference between these two dates.

    SELECTION INTERVAL ' + 2342 23:23:23 ' DAY (4) TO THE SECOND - INTERVAL ' + 102 13:13:13 ' DAY (4) SECOND FROM DUAL;

    But, I get this:

    '+ 2240 10:10:10.000000'

    I'd like to see the result in a year-month and jour-deuxieme groups. I can't do anything with + 2240 days...

    Thanks in advance!

    Hello Adme12

    You can use it.

    SET LINESIZE 110 PAGESIZE 20

    COLUMN today FORMAT A20

    COLUMN TOMORROW FORMAT A20

    COLUMN YEAR_MONTHS FORMAT A15

    COLUMN DAY_SEC FORMAT A30

    SET ECHO ON

    SELECT TO_CHAR (today, ' JJ.) MR. HH24:MI:SS' YYYY) LIKE TODAY

    , TO_CHAR (tomorrow, ' JJ.) MR. HH24:MI:SS' YYYY) TOMORROW

    NUMTOYMINTERVAL (MONTHS_BETWEEN (TOMORROW, TODAY), 'MONTHS') AS YEAR_MONTHS

    , NUMTODSINTERVAL (TOMORROW - ADD_MONTHS (TODAY, TRUNC (MONTHS_BETWEEN (TOMORROW, TODAY))), 'DAY') AS DAY_SEC

    Of

    (SELECT SYSDATE + INTERVAL ' + 102 13:13:13 ' DAY (4) ON THE SECOND THAT TODAY ' HUI)

    , SYSDATE + INTERVAL ' + 2342 23:23:23 ' DAY (4) ON THE SECOND TOMORROW

    OF THE DOUBLE

    )

    ;

    TODAY TOMORROW YEAR_MONTHS DAY_SEC

    -------------------- -------------------- --------------- ------------------------------

    23.04.2014 04:49 10.06.2020 14:59:10 + 000000006-02 + 000000018 10:10:10.000000000

    Of course, it is not so good that you have so many 0, but you can convert the result to a char (TO_CHAR) and you can enter.

    I hope this helps you!

    Kind regards

    David

Maybe you are looking for