Convert number of dayes per year to data

Please i need help in Convert number of dayes to date
I have ID's like id
FT*09025*0000000001 date=20090125
FT*01171*0000000002 date=20100620
so should convert first five number after FT to date
example *09025*
09 map to 2009
025 number of dayes per year map to 25 jan
example *01171*
01 map to 2010
171 number of dayes per year map to 20 jun
(jan+feb+mar+apr+may)=(31+28+31+30+31)=151
171-151=20 for the next month
Please need help so will added filter to informatica map with date
Edited by: user8929623 on Jul 4, 2010 7:04 PM

Well, I do not follow why when 09 maps into 2009, 01 maps into 2010, not into 2001. Assuming it should be 2001, use YYDDD format:
SQL> with t as (
  2             select 'FT*09025*0000000001' id from dual union all
  3             select 'FT*01171*0000000002' from dual
  4            )
  5  select  to_date(substr(id,4,5),'yyddd') dt
  6    from  t
  7  /
DT
20090125
20010620
SQL> SY.

Similar Messages

  • How do you show the number of days per month?

    How do you show the number of days per month?
    I am working on a budget.  I want to know how much to amortize each month to fund an investment.  Income comes monthly, but expenses leave in days, or weeks.  The number of days and weeks in months vary. 
    I want to figure out income and expenses per day, per month and per year, so I know how much can be invested each month, week or day.  For a start I would like a formula that shows how many days are in each month?

    thanks..
    I solve my problem as
    public class MyExample {
        public static void main(String a[]) {
            String stdate = "2009-03-01";
            java.sql.Date currentDate = new java.sql.Date(System.currentTimeMillis());
            java.sql.Date preDate = java.sql.Date.valueOf(stdate);
            System.out.println(currentDate);
            System.out.println(preDate);
    //        int dateCom = preDate.compareTo(currentDate);
    //        System.out.println(dateCom);
            long diff = currentDate.getTime() - preDate.getTime();
            int days = (int) Math.floor(diff / (24 * 60 * 60 * 1000));
             System.out.println(days);
    }

  • Number of days per period cumulated value

    Hi,
    I am using a keyfigure which gives me number of days per period cumulated.
    example
    001.2009  002.2009 003.2009
    30             61            91
    When i multiplying number of days keyfigure with a factor, Its caluculating using before aggregation values. i.e.
    001.2009 = 30*factor
    002.2009 = 31* factor
    003.2009 = 30*factor.
    The requirement is to multiply with cumulated values.
    001.2009 = 30*factor
    002.2009 = 61*factor
    003.2009 = 91*factor.
    Is this possible? If yes any help greatly appreciated.
    Regards,
    Suresh.

    Hi...
    It will answer following questions...
    1. How many days for month Feb' In the year 2008?
    2. How many days for the month Feb' in the year 2007?
    Analyze this program...
    data: var3(2) type n.
    PARAMETERS: var1(2) type n DEFAULT '2',
                var2(4) type n DEFAULT '2008'.
    call function 'NUMBER_OF_DAYS_PER_MONTH_GET'
      exporting
        PAR_MONTH       = var1
        PAR_YEAR        = var2
    IMPORTING
       PAR_DAYS        = var3.
    write:/ 'No. of days in the given month:', var3.
    Thanks,
    Naveen.I

  • How do you work out the number of days difference between two dates?

    I'm running Crystal v12.
    We use a date field in our SQL database that we use to store the client's year end date.
    As the year end date (date and month) doesn't change for a client, the year end date field in all of our reports is set to just show the DD/MM part. Over the years as new clients are set up we just enter the date and month - the year part is irrelevant although as in all date fields the year is automatically entered.
    Doing it this way means that we don't have to adjust the year end year part each year. We just use the DD/MM part.
    I need to create a formula that works out the number of days there have been (i.e. the difference) from the current date to the year end date. It MUST EXCLUDE the year however.
    For example:
    Year End Date = 30/04/03
    Current Date = 25/05/10
    Days Difference (EXCLUDING year) = 25
    Days Difference (including year) = 2582
    Year End Date = 31/03/09
    Current Date = 25/05/09
    Days Difference (EXCLUDING year) = 55
    Days Difference (including year) = 420
    If you include the year part then working out day difference is simply a case of creating a formula that subtracts the year end date from the current date (CurrentDate - {tblClient.YearEnd}.
    HOWEVER I need to exclude the year part.
    Can anyone tell me the formula or best way to do this?
    Thanks in advance.
    Edited by: BadBoy House on May 25, 2010 3:15 PM
    Edited by: BadBoy House on May 25, 2010 3:15 PM

    Hi
    You can try this
    datevar e := date(year(currentdate),month({tblClient.YearEnd}),day({tblClient.YearEnd}));
    numbervar num_days := datediff("d",currentdate,e)
    Create a datevar called e that uses the original month and day numbers for {tblClient.YearEnd} but uses the year of the current date
    Then just datediff on e to get the number of days between the two dates
    I hope i understand your problem and that this helps
    Best regards
    Patrick

  • FM which gives the date if we add 'x' number of days to the current date.

    Hi all,
    can you plz tell me the FM which will give me the exact date if i add some ' X ' number of days to the present date.
    in detail -->my inputs would be    1)DATE
                                                    2)no of days
    i need--> the exact date which comes after those days get added to the given date.
    PLZ HELP ASAP.
    Rgds,
    REDDY.

    Hi,
    You can use FM RP_CALC_DATE_IN_INTERVAL.
    data: wa_date  like sy-datum.
    *Add 21 days to current date.
    call function 'RP_CALC_DATE_IN_INTERVAL'
             exporting
                  date      = sy-datum
                  days      = 21
                  months    = 0
                  signum    = '+'
                  years     = 0
             importing
                  calc_date = wa_date.
    write: / wa_date.
    Regards,
    Ferry Lianto

  • Create a field routine to calculate the number of days per month

    Hi Experts,
    I need to create a field routine to count the number of days per month based on 0CALMONTH. Could you give me some inputs on how to do it?
    Thanks!

    Hi,
    Create InfoObejct and then insert it in InfoSource/InfoCube/DSO then write simp,e code for that based on your  0CALMONTH values.
    You just copy and pas this in SE38 and see the result and implement for your requirements.
    REPORT  ztest1.
    Data: zsydt type sy-datum,
          zd(2) type n,
          zm(2) type n,
          zy(4) type n,
          zcmnth TYPE /bi0/oicalmonth,
          znds TYPE /osp/dt_day.
          zsydt = sy-datum.
          zd = '01'.
          zm = zsydt+4(2).
          zy = zsydt+0(4).
          CONCATENATE zy zm zd INTO zsydt.
          CALL FUNCTION '/OSP/GET_DAYS_IN_MONTH'
                EXPORTING
                  iv_date = zsydt
                IMPORTING
                  ev_days = znds.    "No.of days in month.
          write:/ zd.
          write:/ zm.
          write:/ zy.
          write:/ zsydt.
          write:/ znds.
    Thanks
    Reddy

  • Calculate number of days between two festival dates in payroll schema

    Hi Experts,
    According to my company policy:
    If an empl termination happens before Eid festival of the current year, then the pro-rated Eid bonus (yearly) is based on:
    (The duration between Eid Festival date of previous year - Eid festival date of current year.)/350 days
    Time Evaluation is not implemented in the system. Only payroll is implemented.
    My question: How can I capture the number of days between (Eid Festival date of previous year - Eid festival date of current year) in the payroll schema ?
    Regards,
    Somdeb.

    Hi,
    You can try using date specification. If you update last year eed holiday date for the employee then you can use the operand F along with NUM to get days between last eed holiday and current payroll period last day.
    i.e NUM=FaaT 0
    F is operand to query date specification.
    aa is the date specification.
    T is for unit and it gives number of days
    next space is for current payroll period last day and 0 will reset alternate date to zero if no date specification is mentioned.
    Basically this will give number of days from date mentioned in date type aa to current period last day. For more info you can go through documentation on operand F for NUM.
    Let us know if this helps.
    Regards,
    Poorvi.

  • Need to add number of days to users end date.

    Hi,
    I have a code where we are adding number of days(30) to current date and then updating user's end date in IDM DB.
    Now we have a requirement where we need to add number of days(30) to existing end date of user instead of adding to current date.
    *public String incrementDate(int daysToAdd)
         // Start date
         log.info("NotifyLastDayOfService::incrementDate(): Enter");
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
         Calendar c = Calendar.getInstance();
         c.add(Calendar.DATE, daysToAdd); // number of days to add
         String newDate = sdf.format(c.getTime());
         log.info("NotifyLastDayOfService::incrementDate(): Exit");
         return newDate;
    Have any body implemented this scenario?
    Please suggest.
    Thanks,
    Kalpana.

    Hi Nayan,
    Here is the code:
    System.out.println("----inside increment date method-----");     
              HashMap<String, String> hm = new HashMap<String, String>();
              HashMap<String,Date> modifyMap=new HashMap<String,Date>();
              SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
              tcResultSet usrList = null;
         String enddate = null;
         hm.put("Users.Key",usrKey );
         try {
         usrList = this.usrIntf.findUsers(hm);
         usrList.goToRow(0);
         Date endDate =usrList.getDate("Users.End Date");
         System.out.println("-----users end date-----"+endDate);
         String userEndDate=sdf.format(endDate);
         System.out.println("-----String value of users end date-----"+userEndDate);
         Calendar cal=null;
         System.out.println("-----Calender date-----"+cal);
         cal.setTime(endDate);
         System.out.println("-----end date-----"+endDate);
    cal.add(Calendar.DATE, Integer.parseInt(daysToAdd)); // number of days to add
    Date newEnddate = cal.getTime();
    System.out.println("-----new end date-----"+newEnddate);
    //usrList.setEndDate(Edate);
    modifyMap.put(userEndDate,newEnddate);
    usrIntf.updateUser(usrList, modifyMap);
    System.out.println("updated user's end date in OIM DB");
    //System.out.println("-----updated user's end date in OIM DB-----");
    logger.info("NotifyLastDayOfService::incrementDate(): Exit");
         System.out.println("-----new date-----");
         } catch (tcAPIException e) {
         logger.error("Error in finding end date for user" + e);
         } catch (tcColumnNotFoundException e) {
         logger.error("Error in finding end date for user" + e);
    In th log file, I can see that the code is not executing this line:
    cal.setTime(endDate);
    end date is of type Date and stores users end date from DB. Please help in resolving this issue.
    Thakns,
    Kalpana.

  • Function module which convert number to days to date

    Hi,
    Any one knows any function module which convert total number of days into date.
    thnaks,
    shilpa k

    Hi,
        FIMA_DAYS_AND_MONTHS_AND_YEARS
    FI_PSO_DAYS_MONTHS_YEARS_GET
    RSSM_CONVERT_DAYSEC2TIMESTAMP
    RSSM_CONVERT_TIMESTAMP2DAYSEC
    Function Modules related to Date and Time Calculations
    DATE_COMPUTE_DAY : Returns weekday for a date
    DATE_GET_WEEK : Returns week for a date
    DAY_ATTRIBUTES_GET : Returns attributes for a range of dates specified
    MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.
    END_OF_MONTH_DETERMINE_2 : Determines the End of a Month.
    HR_HK_DIFF_BT_2_DATES : Find the difference between two dates in years, months and days.
    FIMA_DAYS_AND_MONTHS_AND_YEARS : Find the difference between two dates in years, months and days.
    MONTH_NAMES_GET : Get the names of the month
    WEEK_GET_FIRST_DAY : Get the first day of the week
    HRGPBS_HESA_DATE_FORMAT : Format the date in dd/mm/yyyy format
    SD_CALC_DURATION_FROM_DATETIME : Find the difference between two date/time and report the difference in hours
    L_MC_TIME_DIFFERENCE : Find the time difference between two date/time
    HR_99S_INTERVAL_BETWEEN_DATES : Difference between two dates in days, weeks, months
    LAST_DAY_OF_MONTHS : Returns the last day of the month
    Regards

  • 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

  • Program or FM to convert number of days into a CalDay format (ddmmyyy)

    Hi ABAP friends,
    I input calendar day values via a popup calendar from a spreadsheet to BW. So, the values that are populated in BW are the numbers, and not the date.
    For ex. when user selects a calendar day for ex. 11-April-2010, the value in excel is stored as 40279 (which is the number of days starting from 01-Jan-1900) and this is the value that gets stored in BW once we save the data.
    I'm looking for a function module or method or whatever that converts the above number (40279) into CalDay and writes it to the 0CALDAY infoobject ???
    Please help,
    Thanks,
    Venkat

    Thanks Pranaam.
    Two things:
    1. I cannot find this FM. It says FM doesn't exist. SE37 -->  HR_HK_DIFF_BT_2_DATES
    2. My requirement is actually reverse as you explained. I can certainly hard code the starting date: 01011900, but here the input should be the number of days. and I need the date (date2 in your ex.) based on the no. of days entered.
    I found another FM which does exist in my BW system. That is: FIMA_DAYS_AND_MONTHS_AND_YEARS
    Based on "From" & "To" dates, it outputs the number of days.
    But my requirement is:
    Based on the starting date (i.e. always 01011900) and number of days, it should give me the "To" date value.

  • Number of Days from a given Date

    How can one calculate the number of days in a month from a given date?
    Ex: If I pass 07/12/2008 it should return 31

    But your example doesn't meet the OP request. The OP wanted the number of days in a month where the month is determined by a specified date (paraprhased).
    DimaCit gave two credible solutions that met that requirement. Yours just counts the number of days between two apparently arbitrary dates.

  • How to get the number of days between 2 given dates

    Hi all,
    How can I find the number of days between any 2 given dates.
    Thanks

    Hi
    Here's a dirty way:
    If you've got two Date objects in Java, call getTime() on each one (which gives you a value in milliseconds), then subtract the two millisecond values, and divide the result by the number of milliseconds in a day (24 * 60 * 60 * 1000). There's more `elegant' ways to do this, but this method only requires one line of Java.
    Best wishes
    Kevin

  • Calculate number of days based on System Date and a date column!

    Hi everyone,
    I have a query to run a report where the results has a column named “Due Date” which holds a date value based on the project submission date.
    Now, I need to add 4 columns named, “45 Days Expectant”, “30 Days Overdue”, “60 Days Overdue” and “90 Days Overdue”.
    I need to do a calculation based on the “Due Date” and “System (I mean default computer date) Date” that if “System Date” is 45 days+ to “Due Date” than put “Yes” in “45 Days Expectant” row.
    Also, if “Due Date” is less than or equal to system date by 30 days, put “Yes” in “30 Days Overdue” and same for the 60 and 90 days.
    For example the output should be like:
    Is this possible? Can someone help me how to write this Case Statement please? I have some answers how to do it in SSRS (Report Designer) but I want to get the results using T-SQL...Thanks heaps...cheers...
    artistdedigital

    Hi Jay,
    Thanks but those dates are just a reference. The actual table contains hundreds of date rows... so I guess this technique will not work (not sure though)...
    I am quite cool with this bit:
    select duedate,
    case when days > -45 and days < 0 then 'YES' else '' end as '45 Days Expectant',
    case when days between 30 and 60 then 'YES' else '' end as '30 Days overdue',
    case when days between 60 and 90 then 'YES' else '' end as '60 Days overdue',
    case when days > 90 then 'YES' else '' end as '90 Days overdue'
    from cte--------------------------------------------------------------------------------------------------But can you please explain this bit a more? Thanks for being so prompt though : )declare @tab table (duedate datetime)
    insert @tab select '04/25/2014'
    insert @tab select '02/10/2014'
    insert @tab select '01/10/2014'
    insert @tab select '12/10/2013'
    ;with cte
    as
    select duedate,datediff(dd,duedate,getdate()) as days
    from @tab
    artistdedigital

  • Formula to calculate number of days between today's date & given date BEx

    Hello,
    I have a date available as an attribute of dimension characteristic. How do I get current date (sy-datum) to calculate the # of days (or difference) between query execution date and given date.
    Is there a system field to get current or today's date .
    I am thinking to have this as calculated KF in BEx.
    Any suggestions or tips
    Thanks

    Hi,
    Create a variable on the attribute(date attribute) of characterstic. Use this variable to create a formula variable , in which you fin out the difference between current date and varaible.
    There  is a good document on using the attributes in the calculation in service.sap.com/bi
    In infoindex--> calculation with attributes.
    With rgds,
    Anil Kumar Sharma .P

Maybe you are looking for

  • Oracle function and query return different results

    Hi, I am using oracle 10g database. Function is : create or replace FUNCTION FUNC_FAAL(myCode number,firstDate date *, secondDate date)* RETURN INTEGER as rtr integer; BEGIN select count() into rtr* from myschema.my_table tbl where tbl.myDateColumn b

  • How to Find Companies Using SAP CRM in Australia ??

    Hello mate, Could you please tell me how to find out the companies list which are currently using SAP CRM in their organization and located in australia Thanks David

  • Fonts in Latex look ugly

    Hi, i am writing my bachelorthesis in latex. At home i compile it with latex running archlinux and at work i compile my thesis with latex running windows (using MikTex and TeXnicCenter). I compile my thesis with pdflatex and the pdf compiled on windo

  • Convert non-LRS point to LRS-point

    Can you please show me how to convert a non-LRS point to a LRS point? The sdo_lrs.convert_to_lrs_geom function does not work with points. It returns an error: ORA-06531: Reference to uninitialized collection ORA-06512: at "MDSYS.SDO_LRS", line 1767 T

  • Updated to Mac OS X 10.6 Snow Leopard problems

    I update to Mac OS X 10.6.3 Snow Leopard and something is running big time. system hiccups all the time! The color wheel spins all the time. Have done all HD repairs.