Date difference !!! very urgent !!!

Hi,
Thanks for everyones help so far. But the code is still giving me error.
My code is as follows but is still giving error.
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.util.Date,java.sql.*,java.text.*" errorPage="" %>
<%
DateFormat df = DateFormat.getDateInstance();
String s1="01/01/2003";
String s2 = "01/03/2003";
try {
java.util.Date d1 = df.parse(s1);
java.util.Date d2 = df.parse(s2);
long a = d1.getTime();
long b = d2.getTime();
out.print(b-a);
catch (java.text.ParseException pe) {
out.print(pe.getMessage());
%>
It gives the following error :
Unparseable date: "01/01/03"
Thank you.

You can do this,
<%
SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");
String s1="01/01/2003";
String s2 = "01/03/2003";
try {
java.util.Date d1 = df.parse(s1);
java.util.Date d2 = df.parse(s2);
long a = d1.getTime();
long b = d2.getTime();
out.print(b-a);
catch (java.text.ParseException pe) {
out.print(pe.getMessage());
%>

Similar Messages

  • Encrypting and Decrypting Data(Its Very Urgent, Please Help.)

    Hi,
    Can anyone tell me some idea in the below mentioned details.
    Iam creating a Function for Encrypting and Decrypting Data Values using
    DBMS_OBFUSCATION_TOOLKIT with UTL_RAW.CAST_TO_RAW by using
    Key Value as normal.
    But the problem, is it possible to have the key value more than 8.
    Its showing me error when i give the key value less than 8 or more than 8.
    Can u tell me why it happens, is that the limit of the key value or is any other way to do that.
    Its Very Urgent, Please Help.
    Thanks,
    Murali.V

    Is this what you're looking for?
    Usage Notes
    If the input data or key given to the DES3DECRYPT procedure is empty, then the procedure raises the error ORA-28231 "Invalid input to Obfuscation toolkit."
    If the input data given to the DES3DECRYPT procedure is not a multiple of 8 bytes, the procedure raises the error ORA-28232 "Invalid input size for Obfuscation toolkit." ORA-28233 is NOT applicable for the DES3DECRYPT function.
    If the key length is missing or is less than 8 bytes, then the procedure raises the error ORA-28234 "Key length too short." Note that if larger keys are used, extra bytes are ignored. So a 9-byte key will not generate an exception.
    C.

  • Hi Experts ,how to copy database schema without data ? very urgent...*****

    Hi experts,
    How to copying database without Data.
    Its very urgent..pls help out me......
    Thanks
    Vijay

    Use Transfer database objects task or script the objects out using generate scripts wizard from SSMS and apply them in the new server
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Calculate stock of material on a particular date ..very urgent (have points

    Hi all,
    My requirement is to calulate stock of a material on a particular date..
    See.
    I need a function mudule that will accept..
    matnr, date, werks....n give me stock as output..
    Please help me reg. this..
    Have ur points...

    hai pradeep,
    As there is no function module as u said but u can create the function moudule as per ur requimrent in SE37. Just you need the tables from where you want the stock and from which you are giving matnr, date and werks.
    Take the import paramters as matnr, date and werks and export parameter as stock. In source code write the select qurey depending up on the input. i think u know how to write the qurey depending up on the tables from where you want the stock .
    hope this will help you.
    <b>reward if useful</b>
    regards,
    sunil kairam.

  • Date Issue very urgent

    Hi Experts, I am having SY-DATUM. Based on SY-DATUM i required next month first date and after three month end date of the month.

    This is how you can get the first day of next month as the start date and three months later date as end date.
    DATA: v_start_date LIKE sy-datum,
          v_end_date   LIKE sy-datum.
    *-- This will be the last day of the current month
    CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
      EXPORTING
        i_date = sy-datum
      IMPORTING
        e_date = v_start_date.
    *-- This will be the first day of the next month
    v_start_date = v_start_date + 1.
    CALL FUNCTION 'BKK_ADD_MONTH_TO_DATE'
      EXPORTING
        months  = 3
        olddate = v_start_date
      IMPORTING
        newdate = v_end_date.
    WRITE:/ v_start_date, v_end_date.

  • How do I reclaim the unused space after a huge data delete- very urgent

    Hello all,
    How do I reclaim the unused space after a huge data delete?
    alter table "ODB"."BLOB_TABLE" shrink space; This couldn't execute with ora 10662 error. Could you please help

    'Shrink space' has requirements:
    shrink_clause
    The shrink clause lets you manually shrink space in a table, index-organized table or its overflow segment, index, partition, subpartition, LOB segment, materialized view, or materialized view log. This clause is valid only for segments in tablespaces with automatic segment management. By default, Oracle Database compacts the segment, adjusts the high water mark, and releases the recuperated space immediately.
    Compacting the segment requires row movement. Therefore, you must enable row movement for the object you want to shrink before specifying this clause. Further, if your application has any rowid-based triggers, you should disable them before issuing this clause.
    Werner

  • Not inserting date field-very urgent

    thanks in advance any help appreciated
    im getting all the datas in csv as an array and inserting using the insert method, the date(not datetime) field is not inserting (vb.net), and not showing any error
    im getting the datas as array string wat iv to do while inserting ive used all the conversion techniques but still not inserting

    Hi,
    You must indicate the "specified" attribute in order to inset or update any field that is not string type.
    For example, I guess that your program do something like:
    obj.date=%%date expression%%
    but you must do also:
    obj.date_specified=true
    That is for any field like number, date, boolean, etc...that is not a string.
    Hope it helps.
    Kim.

  • Data Transfer- Very Urgent.

    Hi all,
    I am writing a BDC rogram for transaction 'MM01'. For this I want to update data from an excel sheet to internal tabel.Just as we do from flat file to inetrnal table.Can any explainme how to do this.
    Regards,
    Vijay.

    HI I am sending you code. PLease check and tell me where I am going wrong.This is giving a short dump.The excel sheet is saved as Book1(txt file).
    REPORT  ZV_LOCALFILE_ITTABLE .
    DATA : BEGIN OF itab OCCURS 0 ,
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    END OF itab.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = 'D:\Book1.txt'
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      tables
        data_tab                      = itab
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       OTHERS                        = 17
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop at itab.
    write :/ itab-carrid,itab-connid,itab-fldate.
    endloop.
    Regards,
    Vijay

  • Master Data Deletion (Very Urgent)

    Hi Guys,
    What might b the problem, when "not all the master data can be deleted".
    Please respond soon
    avanced tanX
    peter

    Hi,
    you cant delete the master data if its being used by any infoproviders or by a query by including or excluding a value of material. Make sure to delete the master data from all the places then only the system would allow to change the char. I know its pain. backdoor approach, create a ABAP program to delete all the data in the related master data tables S/P/X
    If you have deleted the master data and still not able to change the conversion, activate the object.
    During activation you will get a screen to repair and click that and it will be activated.
    But make sure, you delete all the data in the info provider that uses this obj
    Assign points if helpful
    Regards,
    Hareesh

  • Duplicate records found while loading master data(very urgent)

    Hi all,
    One infopackage in the process chain failed while laoding the master data(full update).Its showing the following error-->duplicate record found ..1 record used in /BI0/PTCTQUERY and the same record occured in /BI0/PTCTQUERY tables.
    can anyone give me the solution...its very urgent...
    Thanks & Regards,
    Manjula

    Hi
    You can see the check box in the Processing tab page. Make a tick mark for the check box Ignore Duplicate Data Records indicator . When multiple data records that have the same key are transferred, the last data record in the request is updated to BI. Any other data records in the request with the same key are ignored.
    Help says that:
    To maintain consistency, ignoring duplicate data records is only possible if the data is updated serially. A serial update is when data is first updated into the PSA then, after it has been successfully written to the PSA, it is updated into the master data or text tables of the InfoObject.
    If a DataSource transfers potentially duplicate data records or if you manually set the Ignore Duplicate Data Records indicator, the PSA Only update type is automatically selected in the scheduler.
    hope it clears ur doubt, otherwise let me know.
    Regards
    Kiran

  • Very Very Urgent Issue: Restricted Key Figure does not return any data

    Hi all,
    Please help me solving this urgent issue.
    created customer exit variable on characterstics version and also
    other customer exit variable on Value type.
    I coded that in variable exit. Problem is when I include these in
    restrickted keyfigure My query does not return me any data.
    But if I remove from restrickted key firgure and put it as normal
    charaterstics I see the variable is getting populated.
    Also in RSRT the SQl generated when these are included in RKF is not
    correct.
    I debugged and know they are getting populated. As when included in RKF
    I can also see the values of customer exit variables from information
    tab.
    I also know that there is data in cube for those restrictions.
    I posted one OSS Notes regarding this urgent issue. But got no reply from SAP.
    FYI: We are using BEx 3.5 Browser SAP GUI 6.4 Patch 20 BW Patch 11
    Thanks
    SAP BW
    **Please do not post the same question twice: Very Urgent Issue: Restricted Key Figure does not return any data

    Hi,
    Everyone out there this is very urgent. If someone can help me solving this problem.
    We are using BEx 3.5 Browser SAP GUI 6.4 Patch 20 BW Patch 11.
    I posted one oss notes also regarding this issue. But got no reply from SAP.
    So, Please help me solving this issue.
    Thanks
    SAP BW

  • Copy Master Datas in FICo from 1 Company Code to Another   ---  Very Urgent

    Hi Peers
    I want to copy all the FI & CO master Data like G/L a/cs , Vendor Master, Customer Master, Cost Centers, Cost Elements, Commitment Items, Funds Center & Assets from one company code to another company code. Both the company codes will have same Chart of accounts. Is there any t.Code by which i can just extend these masters to my company code. Plz help. its very Urgent.
    Expecting a reply ASAP.
    Regards
    Rajaram

    Hi
    In customization,  Assign Chart of A/cs to company code there u will get the path for copying one company code to another company GL Masters.
    And also the CCtrs u already assign to the first company code.  Once u copy the data for one company to another automatically it will copy to another company code.
    Hope this is useful to u.
    Shammi

  • Error in Personnel Data Iview (its very urgent)

    Hi All,
    Personal Data   
    Critical Error
    A critical error has occured. Processing of the service had to be terminated. Unsaved data has been lost.
    Please contact your system administrator.
    failed to create or init instance of model 'com.sap.xss.hr.per.in.pdata.model.HRXSS_PER_P0002_IN' in scope APPLICATION_SCOPE with instanceId 'null'   
    Caused by: com.sap.tc.webdynpro.progmodel.model.api.WDModelException: failed to create instance of model 'com.sap.xss.hr.per.in.pdata.model.HRXSS_PER_P0002_IN'
         at com.sap.tc.webdynpro.progmodel.model.api.WDModelFactory.getNewModelInstance(WDModelFactory.java:392)
         at com.sap.tc.webdynpro.progmodel.model.api.WDModelFactory.getOrCreateModelInstanceFromScopeMaintainer(WDModelFactory.java:329)
         ... 65 more
    Caused by: com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: no jcoMetadata found for RFC function 'HRXSS_PER_GET_F4_P0002_IN'! Please verify, that your model is consistent with the ABAP backend: 'EC6'.
    Hi Please help me to solve this error it's very urgent ?
    thanks and regards,
    Phanikumar.

    Hi,
    I am not very much sure about this.
    Are u calling a BAPi from WD application?
    If yes then the error seems to be that : JCOs metadata is not available.
    Please check that ur JCO definitions in portal and make sure the name in Portal and the name u defined in WD application are same( case  sensitive).
    Also TEST JCO in Portal.
    Please revert back with current status and explain ur problem a bit more.
    Regards,
    Sumit

  • Its very urgent:How to insert data one table to another table

    Hi all,
    i am very new to oaf.
    i have employee_number(per_all_people_f) lov is there.once select the employee number and click on the submit button
    what ever select the employee number it ll move to new_operation_manager in custom table.
    plz help me how to move.
    its very urgent.
    Thanks
    Latha.
    Edited by: Latha on Dec 21, 2011 9:33 PM

    Hi Gyan,
    Sorry, i will not repate.how to close the thread.
    Gyan i have no knowledge on this issue.
    plz help me.and where to mention,data is which table to insert.
    plz send one sample code.
    its very urgent gyan.
    i wrote the am,co codes
    in am:
    public void NewoperationManagerLogic()
    ManagerCustomTableVOImpl vo1=getManagerCustomTableVO1();----> here which vo take
    OADBTransaction oadbt=getOADBTransaction();
    if(!vo1.isPreparedForExecution())
    vo1.executeQuery();
    Row row=vo1.createRow();
    vo1.insertRow(row);
    in Co processrequest:
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
    am.invokeMethod("NewoperationManagerLogic");
    in co processform request:
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    if(pageContext.getParameter("Submit")!=null)
    ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
    am.getOADBTransaction().commit();
    throw new OAException("Records Saved Sucessfully",OAException.INFORMATION);
    thanks
    latha
    Edited by: Latha on Dec 22, 2011 1:26 AM

  • Its very urgent:how to insert data into database tables

    Hi All,
    I am very new to oaf.
    I have one requirement data insert into database tables.
    here createPG having data that data insert into one custom table.
    but i dont know how to insert data into database tables.
    i wrote the code in am,co as follows.
    in am i wrote the code:
    public void NewoperationManagerLogic()
    ManagerCustomTableVOImpl vo1=getManagerCustomTableVO1();
    OADBTransaction oadbt=getOADBTransaction();
    if(!vo1.isPreparedForExecution())
    vo1.executeQuery();
    Row row=vo1.createRow();
    vo1.insertRow(row);
    in createPG processrequest co:
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
    am.NewoperationManagerLogic();
    process form request:
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    if(pageContext.getParameter("Submit")!=null)
    ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
    am.getOADBTransaction().commit();
    please help with an example(sample code).
    its very urgent.
    thanks in advance
    Seshu
    Edited by: its urgent on Dec 25, 2011 9:31 PM

    Hi ,
    1.)You must have to create a EO based on custom table and then VO based on this EO eventually to save the values in DB
    2.) the row.setNewRowState(Row.STATUS_INITIALIZED); is used to set the the status of row as inialized ,this is must required.
    3.) When u will create the VO based on EO the viewattributes will be created in VO which will be assigned to the fields to take care the db handling .
    You must go thtough the lab excercise shipped with you Jdeveloper ,there is a example of Create Employee page ,that will solve your number of doubts.
    Thanks
    Pratap

  • Vendor Master - Purchasing Data Uploading...very...very urgent.

    Dear sapians,
    Is there any tcode for uploading the vendor master purchasing data (only)? like FK15 and FK16 for uploading company code data and general data in Vendor master.
    Please it is very urgent.....
    Thanks to advance
    Senthil

    hi
    go for LSMW , there is no TCODE for uploading data .
    regards
    ravikant dewangan

Maybe you are looking for