Conversion of Date into Number of Days

Hai All,
           Can anyone pls tell how to convert the Date format into Number of days.
For example I have 2 dates, 25.03.2009 and 25.02.2009.
I have to take the difference of these two dates, means its 30 days.
Later I have to move this 30 days to a variable and display.
Can anyone help me.

Try these FMs.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = p_sdate
i_datum_von = p_edate
IMPORTING
e_tage = l_differ
EXCEPTIONS
days_method_not_defined = 1
others = 2.
WRITE:/ l_differ.
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = p_sdate
i_date_to = p_edate
I_FLG_SEPARATE = ' '
IMPORTING
E_DAYS = EDAYS
E_MONTHS = EMONTHS
E_YEARS = EYEARS.
WRITE:/ No of Days ', EDAYS.
Regards,
Joan

Similar Messages

  • Conversion of microseconds to number of days in OSB

    Hi All,
    I want to convert a string variable (e.g1245677889) which represents microseconds.I want to convert this microseconds to corresponding number of days in OSb.I there any xquery function that can be directly used to get the number of days????
    thanks in advance!!!!

    Thanks for the reply.
    I have already done that,But my requirement is to get the corresponding date (with 1970-01-01 as the reference date).
    So i want something in date format on which i can apply some boilt in functions.
    Is there any way we can do increament of an date variable in OSB???
    that will also help if i can increase the date the number of times i get converting miliseconds to days(eg. if miliseconds=86400000 i have to increase the reference date once as 86400000 corresponds to 1 day only) .

  • How to automatically update the Expiry Date's number of days

    My web app input form is an event submission form. Users enter the event title, event date and other details, etc. I've figured out how to get the "expiry days" in the form and it be hidden but i can't figure out how to calculate this:
    (today's date) - (event date) + 1 day = number of days to expire and then set the expiry days to that value upon submission.
    I have tried writing the js but am getting no where, has anyone out there already accomplished this? I've researched and researched and find a million things on calculating the number of days but can't get one of them to work for my situation here... any help would be greatly appreciated!!

    Hi Murtuza,
    You can use function module BAPI_ISUACCOUNT_CHANGE.
    Pass dunning lock details in parameter TCTRACLOCKDETAIL. This function module only create and delete locks.
    So, you need to pass existing lock details (from table DFKKLOCKS) with PROCESSING_MODE = 04 (delete) and append another value with changed expiry date with PROCESSING_MODE = 01 (Create).
    This will also help in maintain lock history too.
    Hope this helps.
    Regards,
    Avinash

  • Current Date plus number of days script

    Hi All,
    I have a form I am building which has a date field (currently setup to specifiy todays date on load).  There is a field that slects number of days until a billing cycle (currently 0 through 13 days).
    I need to setup a script that takes todays date, adds the number of days from the 0-13 result and gives a result of a date (0-13 days from today for example).
    Any thoughts on how I might do this?  Very new to JS.
    Thanks for any help you may be able to provide.
    Ant

    here is an example of what I have used:
    var f = this.getField("BILLINGCYCLEDATE");
    var g1 = this.getField("DAYS");
    var g = g1.value
    var today = new Date();
    var add = d1.valueOf();
    add +=1000 * 60 * 60 * 24 * g; 
    var future = new Date(add);
    f.value = util.printd("mm/dd/yyy", future);
    You would want to set this up as a calculation in your BILLINGCYCLEDATE field.  The field DAYS is whatever you have set up as the 0-13 counter.  I set up a simple text box where you input a number.  The field will then calculate X number of days out.   Hope this helps.

  • Loading unpacked Zoned data into NUMBER data types

    I need to use SQL*Loader to load data created on an MVS machine (EBCDIC) which is FTP'd to AIX (converted to ASCII during the FTP). Some of the data elements have signed unpacked numeric data. These need to be loaded into two types of fields in Oracle - 1) defined as data type NUMBER(19) 2) - defined as data type NUMBER (38,2) (i.e. dollar field with 2 decimal positions). For the dollar data I am loading there is an implied decimal. I need to know how to code SQL*Loader statements to handle these two situations. Because I have zoned unpacked source the resulting data loaded into the table must have a trailing sign (only if negative). Also the dollar fields need to have an explicit decimal inserted - and these dollar fields could also end up being negative.
    Any help would be appreciated. Various google searches have not given me the answers I need.

    979755 wrote:
    Most helpful. Pardon a few follow-on questions:
    1. The Zoned definition refers (I hope) to the data on the input file - regardless of the definition of the field field being loaded in the table (in my case the field in the table is defined as NUMBER) - is this a true statement?
    True, in your controlfile you set (for example): , zonedCol POSITION(x:y) ZONED(precision,scale)
    2. If I am correct on item 1, if I have a negative number in the input file (let's say a negative 10) is a trailing sign loaded into the database (so it will be 10-)?
    NO, to deal with signed numbers, you set trailing signs as table column in a staging table and then apply to real table.
    3. What happens to any leading zeroes when the data is loaded into the table?
    Ignored.
    4. For dollar fields where the source has an implied decimal but I want an implicit decimal in loaded into the table and the number can be positive or negative, can I specify this as ZONED (10.2) in the control file?
    See answer #2.
    ZONED (10,2) implies field is 10 characters long and the last two are decimals.
    5. And finally, regarding item 4 my understanding is that ZONED (10.2) would result in 12345678.12 (with a negative sign if appropriate) - is this a correct understanding?
    Nope, only the digits. That is why we use staging table to capture the sign.
    PS: The best would be to create external table on the source file.
    Edited by: L-MachineGun on Jan 4, 2013 3:12 PM

  • Get Date x number of days before current Date

    How do you subtract x number of days from a Date object?
    Is there a better way than
    int x = 28; // number of days
    long minisPerDay = 24 * 60 * 60 * 1000;
    Date newDate = new Date (oldDate.getTime() - (x * minisPerDay );

    > How do you subtract x number of days from a Date object?
    Calendar c = Calendar.getInstance();
    c.setTime(yourDateInstance);
    c.add(Calendar.DATE, -x);
    Calculating Java dates: Take the time to learn how to create and use dates
    Working in Java time: Learn the basics of calculating elapsed time in Java
    Good luck! :o)
    ~

  • Conversion from date to number & display a date in a textfield

    I Have 2 issues
    The first one:
    I need to extract the hour from a date variable.
    This is the code I already have:
    NUM_TOT := NUM_TEL + to_number('PROGRAMMINGS1.PRG_START','hh24');
    NUM_TOT & NUM_TEL are number variables,
    PROGRAMMINGS1.PRG_START is a Textfiel with a dateformat. There can only be an houre like 24:59:00 entered.
    So in this example I just want the houre and convert it to a number.
    The second:
    I want to make a date from a few numbers & then display it in a texfield.
    This is the code I already have:
    VAR_DATE := NUM_TEL || ':' || NUM_LENGTH || ':00';
    :PROGRAMMINGS.PRG_END := to_date(VAR_DATE,'hh24:mi:ss');
    Between the 2 lines of code i places a message(VAR_DATE) for testing.
    When the program display VAR_DATE then i can see the good date at the bottom of the screen.
    But when I place my variable in the textfield it looks like: 00:00:00. What am I doing wrong?
    Who can help me.
    With regards
    Stefanie

    Verdi wrote:
    Problem: During the conversion (both implicit and explicit conversion with a format mask) I lose the "00" hours and "00" minutes and receive something like this: "10-JAN-13 *12*.00.00.000000000 AM".I don't think you are necessarily losing any information whatsoever. It's probably more of a function of your NLS_TIMESTAMP_FORMAT and NLS_DATE_FORMAT. For example your NLS_DATE_FORMAT could be setup by default for a HH24 (24 hour time) which would report midnight as "00" hours. However, it looks like your NLS_TIMESTAMP_FORMAT is setup with a "HH" format with a meridian indicator which means 12 hours time.
    Your comparisons should be using date/timestamp data types anyways so as long as the input value is converted properly into a date type this shouldn't matter anyways.
    You can see what is actually stored by using the DUMP function:
    SQL> SELECT  DUMP(TO_TIMESTAMP(TO_CHAR(TRUNC(SYSDATE,'DD'),'MM/DD/YYYY HH:MI:SS AM'))) AS TSTAMP
      2  ,       DUMP(TRUNC(SYSDATE,'DD')) AS DT
      3  FROM DUAL
      4  /
    TSTAMP                                                                      DT
    Typ=187 Len=20: 218,7,1,13,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0                  Typ=13 Len=8: 218,7,1,13,0,0,0,0As you can see the TSTAMP and DT store nearly the same values (218,7,1,13), but the TSTAMP has more precision because of fractional seconds.
    HTH!
    Edited by: Centinul on Jan 13, 2010 7:23 AM

  • How to convert exponential data into number for the downloaded excelsheet

    Hi
    I have downloaded one field data i.e. having char of 50,  into excel sheet and it is displaying as  exponential in the excel sheet. 
    The data numbers should display as text only i.e 1236547896321 and not exponential
    Is anyone can tell how we can do this
    Thanks
    Pallavi

    Hello Pallvai,
    The problem of exponential is with the excel. Excel converts the large numbet into exponential.
    To avoid this you can make the number into text then excel won't convert it into exponential.
    For that you can do a simple trick. Just prefix a single quote ( ' ) in the field.
    eg:
    field = 1236547896321.
    then,
    constants c_quote type c value '''.   "<-- single quote
    concatenate c_quote field into field.
    " This will make the EXCEL to consider this field as text not number and hence it will not be considered
    " as exponential.
    Hope this solves your problem.
    Regards,
    Sachinkumar Mehta

  • How to convert the exponential data into number

    Hi,
    I have a table with a column which is a vaarchar2(60). I have a CSV file in which, I have stored value as 77052512125510000, but it got converted into 7.71E16. And when I have stored the same in the database, it got saved as 7.71E16. How can I get the original value
    Please help
    Regards
    Edited by: Sarma12 on May 25, 2012 3:11 AM

    Sarma12 wrote:
    The issue is, the data is already copied into the database. Now while retrieving from the database, I am getting that value in the scientific notation and not similar to the data which I have in the CSV file.
    RegardsYou need to be smarter than the tools you use
    bcm@bcm-laptop:~$ sqlplus user1/user1
    SQL*Plus: Release 11.2.0.1.0 Production on Fri May 25 09:50:02 2012
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    09:50:03 SQL> @test
    09:50:07 SQL> drop table test;
    Table dropped.
    09:50:09 SQL> create table test (id number);
    Table created.
    09:50:10 SQL> insert into test values (77052512125510000);
    1 row created.
    09:50:10 SQL> select * from test;
         ID
    7.7053E+16
    09:50:10 SQL> column id format 999999999999999999999
    09:50:10 SQL> select * from test;
                  ID
         77052512125510000
    09:50:10 SQL>
    09:50:10 SQL>

  • Conversion Oracle data into query

    Hi everyone,
    I've 1000 records in my table. Now i want to create the same table in another database. If i have script to create and insert all values, i can very easily execute it.
    How to generate script for the Oracle table which contains 1000 records?
    -haifriends

    My Sample Table is
    Master_CallType
    ~~~~~~~~~~~~
    CallID CallType
    ~~~~ ~~~~~~
    CT001 Monitor Problem
    CT002 Network Problem
    CT003 Keyboard Problem
    I've a table like this. Create and insert query in used to create table and insert value. Now i've 1000 records in my table. I want to move this value to another database. I want it in script form to create table (with all constrainsts ) and insert value.

  • 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.

  • How to convert date to number

    Hai
    How to convert the given date into number.
    Thanks & regards
    srikkanth.M

    Look at these posts
    Please help me in Converting Lilian Format to Date
    converstion to date
    and try something like this.
    SELECT sysdate,sysdate-to_date('15-10-1582','DD-MM-YYYY') lilian_dt FROM dual;

  • Customer Exit for Number of Days from 1 st Apr to last date of Month Enter

    Hello BI Experts,
    I have a requirement to count the number of days from 1 st April of current year to the last date of month entered.
    For example : The use will enter say July 2010 or 003.2010  (as Fiscal Year Variant is V3 ).
    Today is 14 July ...So we have to first find out the end date of the July month ie 31 st July
    Then go to 1 st April 2010.
    Now calculate the Number of days between 1 st April to 31 st July 2010.
    I consider I have to create two Customer Exit variable
    as below
    1 st customer exit Bex variable  say  ZLY_MTH  ( Last day of Month Entered)
      and i_step = 1
    2 nd Customer Exit BEx Formula variable say ZF_NUMDAYS ( Number of days between two dates)
    i_step =1 .
    Please provide me the logic for the above two.
    Thanks in Advance.
    Regards,
    Amol Kulkarni

    PSUDEO CODE:
    1. Initially LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = 'ZMONTH'.
    2. Get the Month input using VAR_MONTH2 = LOC_VAR_RANGE-LOW+4(2)
    3. Now calculate Month+1: VAR_MONTH2 = VAR_MONTH2 + 1 (Refer **)
    4. Now calculate the Current Year: VAR_YEAR = LOC_VAR_RANGE-LOW+0(4).
    5. Get the 1st Day of the Month (VAR_MONTH2):  CONCATENATE '01' '/' VAR_MONTH2 '/' VAR_YEAR INTO L_S_RANGE-LOW.
    6. SUBRACT 1 (0DATE) from this DATE (This will give the logic for last day of the current month)
    Insert this code also for using the date conversions
            CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
              EXPORTING
                INPUT  = VAR_MONTH2
              IMPORTING
                OUTPUT = VAR_MONTH2.
    Pls. check out this logic. Guess it would solve your need.
    Thanks,
    Arun Bala

  • Date to number conversion?

    I want to select a number of rows created within last week.
    To do it I use a select statement with:
    WHERE sysdate-o.created_on <= days;
    (days is a number, created_on is a date)
    Everything works fine, but I get warnings like this one:
    PLW-07204: conversion away from column type may result in sub-optimal query plan
    I suppose I should convert date to number to get rid of them. How can I do it isnide a SELECT query?

    While the comments regarding re-writting the query to allow the possibility of index usage are valid, the warning will still appear even with the re-written query. I am sure that this query would use an index on dt1 if one was available.
    SQL>CREATE TABLE t (id number, dt1 date, dt2 date);
    Table created.
    SQL> CREATE PROCEDURE p1 AS
      2  BEGIN
      3     FOR r IN (SELECT * FROM t
      4               WHERE dt1 = sysdate - 7) LOOP
      5        NULL;
      6     END LOOP;
      7  END;
      8  /
    SQL>/
    SP2-0804: Procedure created with compilation warnings
    SQL>show error
    Errors for PROCEDURE P1:
    LINE/COL ERROR
    3/13     PLW-07204: conversion away from column type may result in
             sub-optimal query planThe warning in this case is clearly spurious, and the reason is, at the level the compiler is looking, they are different data types. dt1 was inserted as sysdate a few minutes before I did the dunp below.
    SQL> SELECT DUMP(dt1) tab_date, DUMP(dt1 - 3) calc_date,
      2         DUMP(sysdate) sys_date
      3  FROM t;
    TAB_DATE                            CALC_DATE                          SYS_DATE
    Typ=12 Len=7: 120,107,2,27,10,45,42 Typ=13 Len=8: 7,215,2,24,9,44,41,0  Typ=13 Len=8: 7,215,2,27,9,49,13,0A date field in a table is a type 12 while sysdate, and any date that has is a result of a calculation is a type 13. Clearly a "different" datatype.
    Practically speaking, in the SQL engine, the type 13 date would be cast to a type 12 date and used in an index probe, but the compiler is likely doing something similar to the DUMP conparision.
    I believe that the type 13 dates are a representation of the C time_t struct that Oracle's kernel would likely use internally.
    John

  • 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.

Maybe you are looking for

  • K9N Neo-F and AMD Athlon X2 AM2 6000+ (125W)

    Hi Everyone! I want to upgrade my PC, now I have: MSI K9N Neo-F motherboard S/N: 601-7260-010K0609058577 MS-7260 ver. 1.0 K9N Neo nForce 550, AMD AM2 CPU: AMD Athlon X2 AM2 3800+ RAM: GoodRam 2x512MB (667) and 2x1GB (667) GPU: Zotac GF 8800GT Now I w

  • CO06 question

    Hello, I have a problem with entries in the CO06 transaction. Lets assume the following. 1. - I have a confirmed sales order which has an entry in CO06. 2. - I have a purchase order related to the sales order. 3. - I have a inbound delivery related t

  • Multiple X axes in DIAdem 9.1

    Is it possible to have multiple X-axis scales for a 2-D plot in DIAdem 9.1?  I have no problem with multiple y axes but I would also like multiple x axes as well. Thanks, Tom

  • Sales invoice hitting cross company code transaction

    Hi, Material and customer maintaining in the same company code and sales order raised accordingly. but when we are trying to post delivery it is generating cross company code transactions. what are the possible reasons. sairavi

  • How to make a "Program" out of my .java files?

    I have made a little application that stores a file to disk. Is there someway to make a file out of my .java files so it can be run without opening my editor and choosing run?