How to convert days to years, months and remaining days

Hi All,
I have the number of days for example : 398 days how to
convert 398 days to number of years and number of months and remaining days
like 398 days 1 year , 1 month and 2 days
Regards
rkrao

e.g.
SQL> select sysdate, sysdate - 1234 from dual
  2  /
SYSDATE   SYSDATE-1
09-AUG-06 24-MAR-03
SQL> select trunc(trunc(months_between (sysdate, sysdate - 1234))/12) yrs,
  2  mod(trunc(months_between(sysdate, sysdate - 1234)), 12) mnths,
  3  sysdate - add_months((sysdate - 1234), trunc(months_between(sysdate, sysdate - 1234))) dys
  4  from dual
  5  /
       YRS      MNTHS        DYS
         3          4         16
SQL>

Similar Messages

  • How to get date difference in terms of years,months and also days

    Tool : Eclipse
    Framework : JSF & Springs
    JRE : jdk1.5.0_06
    Iam using oracle 10G DB as back end.I have two date fields in a table.
    1)premium_paying_start_date
    2)premium_paying_end_date
    Iam getting these two dates from the database and storing these values within a entity.Now in the delegate layer,
    i have to get the premium_term i.e, the difference between the two dates(premium_paying_end_date-premium_paying_start_date).
    The difference should show the year,month and no of days difference.
    For example :
    premium_paying_start_date : 14-10-1984
    premium_paying_end_date : 01-03-2008
    Difference should be : 23 Y : 4 M : 15 D (Y = years, M = months , D= days)
    So please give me the solution for this.

    Difference should be : 23 Y : 4 M : 15 D (Y = years, M = months , D= days)
    So please give me the solution for this.How did you determine what the difference should be?
    ~

  • FM to get the number of days in Year,month and days by giving number of day

    Hi ALL,
    This is quit differnt.
    I need to give input the 'start date' and the 'number of days' and get the total days from the start date in year,month and day format.
    for example.
    start date :01.01.2009
    number of days as 32
    then i should get
    years:0
    months :1
    days :1
    Pleas help me out.

    hi Anusha,
    first u pass the date and the days to the following fm you will get the result date....
    data:date type sy-datum,
          r_date(10) type c.
    date = sy-datum.
    CALL FUNCTION 'CALCULATE_DATE'
    EXPORTING
       DAYS              = '32'
       MONTHS            = '0'
       START_DATE        = date
    IMPORTING
       RESULT_DATE       = r_date
    write:/ r_date.
    then you need to pass the result date and the date to the following fm to get the required output...
    CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
        EXPORTING
          date1                   = r_date
          date2                   = date
        IMPORTING
          years                   = v_years
         months                 = v_months
        days                     = v_days
        EXCEPTIONS
          invalid_dates_specified = 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.
    here u will get the difference in days,  months and year...
    i hope u wil get help from this...
    regards
    Ashu  Singh

  • How to get the difference of two dates in years,months and days

    Hi friends,
    how to get the difference of two dates in years,months and days
    for ex 2 years 3 months 13 days
    select (sysdate-date_Start) from per_periods_of_service
    thanks

    Something like this...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select to_date('17-nov-2006','dd-mon-yyyy') as c_start_date, to_date('21-jan-2008','dd-mon-yyyy') as c_end_date from dual union all
      2             select to_date('21-nov-2006','dd-mon-yyyy'), to_date('17-feb-2008','dd-mon-yyyy') from dual union all
      3             select to_date('21-jun-2006','dd-mon-yyyy'), to_date('17-jul-2008','dd-mon-yyyy') from dual
      4             )
      5  -- end of test data
      6  select c_start_date, c_end_date
      7        ,trunc(months_between(c_end_date, c_start_date) / 12) as yrs
      8        ,trunc(mod(months_between(c_end_date, c_start_date), 12)) as mnths
      9        ,trunc(c_end_date - add_months(c_start_date, trunc(months_between(c_end_date, c_start_date)))) as dys
    10* from t
    SQL> /
    C_START_D C_END_DAT        YRS      MNTHS        DYS
    17-NOV-06 21-JAN-08          1          2          4
    21-NOV-06 17-FEB-08          1          2         27
    21-JUN-06 17-JUL-08          2          0         26
    SQL>But, don't forget that different months have different numbers of days, and leap years can effect it too.

  • Converting a number into years, months and days...

    Hi everyone,
    I have a number say 399.
    I need to know how many years and months constitute that number.
    For eg 399 would be 1yr, 1 month and 4 days.
    So I need the answer as 1 yr and 1 month.
    Is there any inbuilt funtion to say this?
    Thanks
    Kishore

    following a quick (and dirty) solution.
    What about the leap years?
    define v_startdate='01-01-2003'
    define v_juliandays=399
    SELECT
    TRUNC (         MONTHS_BETWEEN ( TO_DATE('&&v_startdate','MM-DD-YYYY') + &&v_juliandays,
                                     TO_DATE('&&v_startdate','MM-DD-YYYY')
                                   )/12) "Years",
    TRUNC ( MOD (   MONTHS_BETWEEN ( TO_DATE('&&v_startdate','MM-DD-YYYY') + &&v_juliandays,
                                     TO_DATE('&&v_startdate','MM-DD-YYYY')
                                   ) ,12)) "Months"
    FROM DUAL;

  • Convert two dates difference to number of years, months and days

    Post Author: gigimonu
    CA Forum: Formula
    I wanted to write a formula (if there is a function I can use) that can convert a date difference to total number of years, months and days example
    adate = 10/22/2006
    ?xdate = current date - adate (answer should be 1 years, 0 months and 0 days)
    Please help
    Thanks

    Post Author: V361
    CA Forum: Formula
    &#91;Years, Months, Days&#93;
    DATEVAR FROMDATE := DATE(2000,01,01); // FROM DATE
    DATEVAR TODATE := CURRENTDATE; // TO DATE
    NUMBERVAR YEARS;
    NUMBERVAR MONTHS;
    NUMBERVAR DAYS;
    STRINGVAR DIFF;
    DATEVAR TEMP;
    IF TODATE < FROMDATE THEN
    (TEMP := TODATE;
    TODATE := FROMDATE;
    FROMDATE := TEMP);
    YEARS := DATEDIFF('YYYY',FROMDATE,TODATE);
    IF YEARS > 2 THEN
    (YEARS := YEARS - 2;
    TEMP := DATE(DATEADD("M",YEARS * 12,FROMDATE));)
    ELSE
    (YEARS := 0;
    TEMP := FROMDATE);
    WHILE TRUE DO
    (TEMP := DATE(DATEADD('M',1,TEMP));
    IF TEMP > TODATE THEN
    EXIT WHILE;
    MONTHS := MONTHS + 1);
    DAYS := DATEDIFF('D',DATE(DATEADD('M',-1,TEMP)),TODATE);
    IF MONTHS > 12 THEN
    (YEARS := YEARS + INT(MONTHS/12);
    MONTHS := MONTHS MOD 12);
    DIFF := IIF(YEARS>0 ,TRIM(TOTEXT(YEARS,0)) & " YEARS " ,"0 YEARS ") &
    IIF(MONTHS>0,TRIM(TOTEXT(MONTHS,0))& " MONTHS ","0 MONTHS ")&
    IIF(DAYS>0 ,TRIM(TOTEXT(DAYS,0)) & " DAYS" ,"0 DAYS");

  • Elapse days - calculation from month and year

    Duplicate thread ...
    coding  required for converting month into days
    I have Month and year field in my DSO --Year( 2009), Month(4)
    I want below logic to calculate -
    MTD qty % = (qty * elapse days) / no of days in month
    so from the above, I want to know,
    1. How can we get the no of days from the above 2 objects (year and month).
    2. Elapse days are the days that are over from current date to Ist day of that month.
    eg: current date - 04.03.2009 , 1st day of the month - 04.01.2009,
    elapse days = 2. (you need to consider all days in the month, not only working days)
    so my questions is how can we get, # of days n a month from above 2 fields and elapse days based on the above condition.
    also want to know, where can I have the logic in transformations or query level.
    please provide your suggestions.
    Thanks,
    Pra
    Edited by: Arun Varadarajan on Apr 5, 2009 10:44 PM
    Edited by: Arun Varadarajan on Apr 5, 2009 10:45 PM

    Hello,
    I think the sample program below does what you ask: it finds the days in the month (bit of an overkill to use function modules for that) and then computes the QTD.
    Note that the internal string representation of a data variable is always YYYYMMDD, regardless of the "externalized" form (e.g. yyyy/mm/dd or dd.mm.yyyy), so this code will work regardless of your custom date format.
    Regards,
    Mark
    REPORT  zqty_to_date.
    PARAMETERS:
      p_date     TYPE dats,
      p_qty      TYPE i.
    DATA:
      days      TYPE i,
      n_year    TYPE numc4,
      n_month   TYPE numc2,
      n_day     TYPE numc2,
      qtd(6)    TYPE p DECIMALS 1.
    START-OF-SELECTION.
      n_year = p_date+0(4).
      n_month = p_date+4(2).
      n_day = p_date+6(2).
      PERFORM days_in_month USING n_year n_month CHANGING days.
      qtd = ( p_qty * ( n_day - 1 ) ) / days.
      WRITE: / 'Days in month:', days,
             / 'Qty  to date :', qtd.
    *&      Form  days_in_month
    *       text
    FORM days_in_month USING year month CHANGING days.
      DATA: ymod4   TYPE i,
            ymod100 TYPE i,
            ymod400 TYPE i.
      CASE month.
        WHEN 4 OR 6 OR 9 OR 11.
          days = 30.
        WHEN 2.
          ymod4 = year MOD 4.
          ymod100 = year MOD 100.
          ymod400 = year MOD 400.
          IF ( ymod4 = 0 AND ymod100 > 0 ) OR ( ymod100 = 0 AND ymod400 = 0 ).
            days = 29.
          ELSE.
            days = 28.
          ENDIF.
        WHEN OTHERS.
          days = 31.
      ENDCASE.
    ENDFORM.                    "days_in_month

  • How to add a date(Year, Month, Day) table in OBIEE Administrator

    Hi,
    I am new to this tool, we are developing a HR report for emp on leave or absentees. we have data since 1982 in our tables. we want to have a date table and dimension where we can give have a hierarchy for year, month, day, so that we can design our dashboards based on time. how we can do that in OBIEE Administrator and can we do it in warehouse builder as well, if so, how. ( we have a column for date in the table by name 'leave start date' and 'leave end date', can we use this and create our own table with year month and day as separate columns).
    Thanks.

    hi,
    Using date column u can create time dim in BMM layer
    Create a new logical table and pull your date column to this table
    Next,create following columns
    Refer http://www.rittmanmead.com/2007/04/30/obi-ee-time-dimensions-and-time-series-calculations
    leave start date
    Year level :Extract(year from date_column)
    Month and year level:CAST (Extract(month from fact_date_column) As CHAR(5) ) || CAST (Extract(yearfrom fact_date_column) As CHAR(5) )
    Mon-YYYY: EVALUATE('TO_CHAR(%1,%2)' AS CHARACTER ( 30 ), "Development".""."sample sales"."Dim - leave Date"."REPORT_DATE", 'MON-YY')
    YYYY-MM : CAST ( EXTRACT( YEAR FROM "sample sales".""."sample"."Dim - Report Date"."LEAVE_DATE") AS CHARACTER ( 4 )) || '/' || CASE WHEN EXTRACT( MONTH FROM "sample sales".""."sample"."Dim - Report Date"."LEAVE_DATE") BETWEEN 10 AND 12 THEN CAST ( EXTRACT( MONTH FROM "sample sales".""."sample"."Dim - Report Date"."LEAVE_DATE") AS CHARACTER ( 2 )) ELSE '0' || CAST ( EXTRACT( MONTH FROM "sample sales".""."sample"."Dim - Report Date"."LEAVE_DATE") AS CHARACTER ( 1 )) END
    Year Quater :: EVALUATE('TO_CHAR(%1,%2)' AS CHARACTER ( 6 ), "sample sales".""."sample"."Dim -Leave Date"."REPORT_DATE", 'YYYY') || '0' || EVALUATE('TO_CHAR(%1,%2)' AS CHARACTER ( 6 ), "sample sales".""."sample"."Dim -Leave Date"."REPORT_DATE", 'Q')
    Day: EXTRACT(DAY FROM DATE_COLUMN)
    Thanks,
    Saichand.v

  • Date separate year, month and day

    Hello everyone and thanks in advance, I'm new to this and the truth is not doing this.
    Well, I have a PDF with several pages which I designed and has been asking me in a complete date in the format dd / mm / yy and subsequent pages he asks me the same date of birth but in 3 separate fields, day , month and year. I want you when you enter the date the first copy and separate day month and year in others. I tried this but I get
    var array_datesol = datesol.split("/")
    var year = parseInt(array_datesol[2]);
    var month = parseInt(array_datesoll[1]);
    var day = parseInt(array_datesol[0]);
    this.getField('yearsol').value = year;
    this.getField('monthsol').value = month;
    this.getField('daysol').value = day;
    where is the initial field datesol date and year, month and day where they have to be separately
    thanks in advance

    Are you getting any errors in the JavaScript debugging console?
    You are using the syntax for the 'Custom JavaScript calculation' and this syntax can not be used in the 'simplified field notation. Also you can not use any JavaScript properties, objects, functions, control statments.
    When run in the console, I find you have a misspelling of the variable name 'datesol'. I also do not see where you are initializing the value for 'datesol'.
    var datesol = event.valueAsString;  // get value of this field
    var array_datesol = datesol.split("/") ; // make into an array
    this.getField('yearsol').value =array_datesol[2];  // get element year
    this.getField('monthsol').value = array_datesol[1];  // get month element - fixed variable name
    this.getField('daysol').value = array_datesol[0]; // get date element
    I would use one of the following so the other fields are only updated when a date has been entered and the leading zeros are displayed:
    this.getField('yearsol').value = '';
    this.getField('monthsol').value = '';
    this.getField('daysol').value = '';
    if(event.value != '') {
    // get parts of date and print with leading zeros
    var datesol = event.value;  // get value of this field
    var array_datesol = datesol.split('/') ; // make into an array
    this.getField('yearsol').value = util.printf('%,304.0f', array_datesol[2]);  // get element year
    this.getField('monthsol').value = util.printf('%,302.0f', array_datesol[1]);  // get month element - fixed variable name
    this.getField('daysol').value = util.printf('%,302.0f', array_datesol[0]); // get date element
    // or
    this.getField('yearsol').value = '';
    this.getField('monthsol').value = '';
    this.getField('daysol').value = '';
    if (event.value != '') {
    // get date parts and print with leading zeros
    var oDatesol = util.scand('dd/mm/yyyy', event.value); // get date object
    this.getField('yearsol').value = util.printf('%,302.0f',oDatesol.getFullYear());  // get element year
    this.getField('monthsol').value = util.printf('%,302.0f', oDatesol.getMonth() + 1);  // get month element - fixed variable name
    this.getField('daysol').value = util.printf('%,302.0f', oDatesol.getDate()); // get date element
    // or
    this.getField('yearsol').value = '';
    this.getField('monthsol').value = '';
    this.getField('daysol').value = '';
    if(event.vaue != '') {
    // get parts of date and format
    var oDatesol = util.scand('dd/mm/yyyy', event.value); // get date object
    this.getField('yearsol').value = util.printd('yyyy', oDatesol); // get element year
    this.getField('monthsol').value = util.printd('mm', oDatesol); // get month element - fixed variable name
    this.getField('daysol').value = util.printd('dd', oDatesol); // get date element
    If you are going to fill other field, you will need to use the '.valueAsStriing' property or '.toString()'  method to retain the leading zeros.

  • Conversion of days to year&months (HR)

    Hi friends,
    I'm working for one BI HR report, where i'm getting employee experience in days. I want to convert days into years& months. Eg: 850 days means 2 yrs 4months. At cube level i'm getting number of days, how can i get it at query level?
    thanks,
    Sridhar

    please find the complete code
      DATA: L_DATE TYPE D,
            L_TIME TYPE T,
            E_TIMESTMP like RSGENERAL-TIMESTMP,
            FINAL_DATE(16),
            INDATE LIKE PSO02-ZFBDT,
            DD TYPE i,
            MM TYPE i,
            yy TYPE i.
      PARAMETERS: I_DAYS TYPE i.
      GET TIME STAMP FIELD E_TIMESTMP.
      CONVERT TIME STAMP E_TIMESTMP TIME ZONE 'UTC+12' INTO
              DATE L_DATE TIME L_TIME.
      SUBTRACT I_DAYS FROM L_DATE.
      CONVERT DATE L_DATE TIME L_TIME INTO
              TIME STAMP E_TIMESTMP TIME ZONE 'UTC+12'.
      FINAL_DATE = E_TIMESTMP.
      INDATE = FINAL_DATE+1(8).
      CALL FUNCTION 'FI_PSO_FULL_DAY_MONTH_YEAR_GET'
        EXPORTING
          I_DATE_FROM          = SY-DATUM
          I_DATE_TO            = INDATE
       IMPORTING
         E_DAYS               = DD
         E_MONTHS             = MM
         E_YEARS              = YY  .
    WRITE:/ yy, mm, dd.
    but FM 'FI_PSO_FULL_DAY_MONTH_YEAR_GET' is not avialble in BI side, it is there in R/3 . You need to create in BI, then you can use it.
    bhaskar

  • Getting year, month and date

    I am getting the current year, month and date as follows:
    public void setDate(Date date) {
    String strDate = "";
    //year
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    strDate += cal.get(Calendar.YEAR);
    //month
    strDate += cal.get(Calendar.MONTH) + 1;
    //date
    strDate += cal.get(Calendar.DATE);
    this.date = strDate;
    }This gives me the date in teh format yyyymd.
    i.e for Mar 5 2007, it returns 200735
    How can it retrieve it in yyyymmdd format?
    i.e. Mar 5 2007 must be 20070305

    use the function:
    private String getTwoNumberFormat(int i){
         if (i<10)
              return "0"+i;
         else
              return ""+i;
    }and then call
    //month
    strDate += getTwoNumberFormat(cal.get(Calendar.MONTH)+1);or use SimpleDateFormat :)

  • Report displaying days of a month and projects

    Hi,
    I want to create a spreadsheet-like report displaying the days of a month as columns and the projects as rows. It is a report of the daily hours worked on the projects.
    It should look like this:
    Sat Sun Mon Tue ... Mon
    1. 2. 3. 4. ... 31.
    project1 3.5 1.0 2.5 etc.
    project2 5.0 2.5 etc.
    project3 1.0 4.5 etc.
    I got two tables (a little simplified), a table "day" with the columns
    id NUMBER(9)
    day DATE
    and a depending table "hours"
    id NUMBER(9)
    day_id NUMBER(9)
    project_id NUMBER(9)
    worked_hours NUMBER(6,2)
    I got it together (a little simplified) what I want for the current day:
    select
    '', to_char(sysdate, 'Day')
    from dual
    union all
    select
    '', to_char(sysdate, 'DD.MM.YYYY')
    from dual
    union all
    select
    h.project_id, h.worked_hours
    from day d, hours h
    where d.id = h.day_id
    Now the big question: How do I expand that to the full month as shown above?
    How do I display the whole month and the corresponding hours of a project every day?
    Anyone has a done something similar or has a hint?
    Any help is highly appreciated,
    regards,
    Roger

    I see others have already given answers the same... but hey, I spent a few minutes on it so I'm giving mine too. ;)
    SQL> ed
    Wrote file afiedt.buf
      1  with day as (select rownum as id, to_date('01/10/2007','dd/mm/yyyy')+rownum-1 as Day from dual connect by rownum <= 31)
      2      ,hours as (select rownum as id, x.rn as Day_id, y.rn as project_id, rownum as worked_hours
      3                 from (select rownum rn from dual connect by rownum <= 31) x
      4                     ,(select rownum rn from dual connect by rownum <= 5) y
      5                     )
      6  -- end of test data
      7  select h.project_id
      8        ,CAST(MAX(decode(to_char(d.day,'DD'),'01',h.worked_hours,NULL)) as varchar2(3)) as D01
      9        ,CAST(MAX(decode(to_char(d.day,'DD'),'02',h.worked_hours,NULL)) as varchar2(3)) as D02
    10        ,CAST(MAX(decode(to_char(d.day,'DD'),'03',h.worked_hours,NULL)) as varchar2(3)) as D03
    11        ,CAST(MAX(decode(to_char(d.day,'DD'),'04',h.worked_hours,NULL)) as varchar2(3)) as D04
    12        ,CAST(MAX(decode(to_char(d.day,'DD'),'05',h.worked_hours,NULL)) as varchar2(3)) as D05
    13        ,CAST(MAX(decode(to_char(d.day,'DD'),'06',h.worked_hours,NULL)) as varchar2(3)) as D06
    14        ,CAST(MAX(decode(to_char(d.day,'DD'),'07',h.worked_hours,NULL)) as varchar2(3)) as D07
    15        ,CAST(MAX(decode(to_char(d.day,'DD'),'08',h.worked_hours,NULL)) as varchar2(3)) as D08
    16        ,CAST(MAX(decode(to_char(d.day,'DD'),'09',h.worked_hours,NULL)) as varchar2(3)) as D09
    17        ,CAST(MAX(decode(to_char(d.day,'DD'),'10',h.worked_hours,NULL)) as varchar2(3)) as D10
    18        ,CAST(MAX(decode(to_char(d.day,'DD'),'11',h.worked_hours,NULL)) as varchar2(3)) as D11
    19        ,CAST(MAX(decode(to_char(d.day,'DD'),'12',h.worked_hours,NULL)) as varchar2(3)) as D12
    20        ,CAST(MAX(decode(to_char(d.day,'DD'),'13',h.worked_hours,NULL)) as varchar2(3)) as D13
    21        ,CAST(MAX(decode(to_char(d.day,'DD'),'14',h.worked_hours,NULL)) as varchar2(3)) as D14
    22        ,CAST(MAX(decode(to_char(d.day,'DD'),'15',h.worked_hours,NULL)) as varchar2(3)) as D15
    23        ,CAST(MAX(decode(to_char(d.day,'DD'),'16',h.worked_hours,NULL)) as varchar2(3)) as D16
    24        ,CAST(MAX(decode(to_char(d.day,'DD'),'17',h.worked_hours,NULL)) as varchar2(3)) as D17
    25        ,CAST(MAX(decode(to_char(d.day,'DD'),'18',h.worked_hours,NULL)) as varchar2(3)) as D18
    26        ,CAST(MAX(decode(to_char(d.day,'DD'),'19',h.worked_hours,NULL)) as varchar2(3)) as D19
    27        ,CAST(MAX(decode(to_char(d.day,'DD'),'20',h.worked_hours,NULL)) as varchar2(3)) as D20
    28        ,CAST(MAX(decode(to_char(d.day,'DD'),'21',h.worked_hours,NULL)) as varchar2(3)) as D21
    29        ,CAST(MAX(decode(to_char(d.day,'DD'),'22',h.worked_hours,NULL)) as varchar2(3)) as D22
    30        ,CAST(MAX(decode(to_char(d.day,'DD'),'23',h.worked_hours,NULL)) as varchar2(3)) as D23
    31        ,CAST(MAX(decode(to_char(d.day,'DD'),'24',h.worked_hours,NULL)) as varchar2(3)) as D24
    32        ,CAST(MAX(decode(to_char(d.day,'DD'),'25',h.worked_hours,NULL)) as varchar2(3)) as D25
    33        ,CAST(MAX(decode(to_char(d.day,'DD'),'26',h.worked_hours,NULL)) as varchar2(3)) as D26
    34        ,CAST(MAX(decode(to_char(d.day,'DD'),'27',h.worked_hours,NULL)) as varchar2(3)) as D27
    35        ,CAST(MAX(decode(to_char(d.day,'DD'),'28',h.worked_hours,NULL)) as varchar2(3)) as D28
    36        ,CAST(MAX(decode(to_char(d.day,'DD'),'29',h.worked_hours,NULL)) as varchar2(3)) as D29
    37        ,CAST(MAX(decode(to_char(d.day,'DD'),'30',h.worked_hours,NULL)) as varchar2(3)) as D30
    38        ,CAST(MAX(decode(to_char(d.day,'DD'),'31',h.worked_hours,NULL)) as varchar2(3)) as D31
    39  from day d, hours h
    40  where h.day_id = d.id
    41  group by h.project_id
    42* order by h.project_id
    SQL> /
    PROJECT_ID D01 D02 D03 D04 D05 D06 D07 D08 D09 D10 D11 D12 D13 D14 D15 D16 D17 D18 D19 D20 D21 D22 D23 D24 D25 D26 D27 D28 D29 D30 D31
             1 1   6   11  16  21  26  31  36  41  46  51  56  61  66  71  76  81  86  91  96  101 106 111 116 121 126 131 136 141 146 151
             2 2   7   12  17  22  27  32  37  42  47  52  57  62  67  72  77  82  87  92  97  102 107 112 117 122 127 132 137 142 147 152
             3 3   8   13  18  23  28  33  38  43  48  53  58  63  68  73  78  83  88  93  98  103 108 113 118 123 128 133 138 143 148 153
             4 4   9   14  19  24  29  34  39  44  49  54  59  64  69  74  79  84  89  94  99  104 109 114 119 124 129 134 139 144 149 154
             5 5   10  15  20  25  30  35  40  45  50  55  60  65  70  75  80  85  90  95  100 105 110 115 120 125 130 135 140 145 150 155
    SQL>

  • Show data of last day of previous month against any day of current month

    Hi,
    I have fact table which contains data at date level (we have data for oct-2009 to april-2010). Our requirement is to show data of last day of previous month against any day of current month in obiee 11g. I am facing problem in Feb 2010 its picking data of 28-Jan-2010 instead of 31-jan-2010 and for April its picking data of 30-mar-2010 instead of 31-mar -2010.
    Any suggestion ???

    You're asking to filter your data set to only include rows between:
    1) last day of the previous month
    2) any day of the current month
    This can be achieved with prompting in OBIEE Answers.
    last day of previous month = TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) . The problem is you need to make query work within Oracle's Answer syntax.
    In the prompt, select the operator type for your date dimension as 'between' and default to 'SQL Results'.
    For the 'last day of previous month' , use the query:
    SELECT
    case when 1=0 then Time."Fiscal Date" else TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))
    end
    FROM ENTER_YOUR_PRESENTATION_FACT_FOLDER_HERE
    For the current date, use the query:
    SELECT
    case when 1=0 then Time."Fiscal Date" else CURRENT_DATE
    end
    FROM ENTER_YOUR_PRESENTATION_FACT_FOLDER_HERE
    Another option is to create a last_date_pervious_month variable in the RPD and have that as the default value in your prompt.

  • HT1918 I have opened my account on my credit card and there has been 3 payments go from my account. 17.49 and then day before 5.49 and 4 days before 4.99. Really annoyed that apple can let this happen and letting app makers con people by doing this. Anapp

    I have opened my account on my credit card and there has been 3 payments go from my account. 17.49 and then day before 5.49 and 4 days before 4.99. Really annoyed that apple can let this happen and letting app makers con people by doing this.
    Don't know how this has happened, would like a refund what is the procedure.

    You haven't bought any items, including in-app purchases within apps and/or auto-renewing subscriptions ? You can view the purchase history on your computer's iTunes : http://support.apple.com/kb/HT2727
    If you haven't made any purchases, and nobody else has access to your account or devices and may have made them, then you can contact iTunes Support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • How to set filter criteria for month and year using in timestamp input field?

    Hi,
    I am using jdev 11.1.2.3,
    I have one problem with Report generation,,,,,,I have one report table which is in the form of VO(query based) and i want to search this table as month and year basis
    but in this table(query) that field having timestamp based value.. how to search with month name and year only.. Here i am using totally query base VO's for generating
    reports........ Can any one guide me.
    Thank You.

    You can use a inputdate, which allows you to selecte a moth, year and a day. Once the selection is made you convert it to only allow moth and date like
            <af:inputDate label="Label 1" id="id1" autoSubmit="true" value="#{bindings.myMonthYear1.inputValue}">
              <f:convertDateTime pattern="MM/yyyy"/> 
            </af:inputDate>
            <af:outputText value="Selected #{bindings.myMonthYear1.inputValue}" id="ot1" partialTriggers="id1"/>
    then you have a string holding month and year only. This value you split into two variables you or pass it as a whole parameter to the query and split it there.
    Another way is to add two static lovs one for month and one for year and use them to get to the filter values.
    Timo

Maybe you are looking for