Error in compare date

hi to all
i created a java program for validateing two date
start date should be less than end date
end date should be greater than start date
and here is my code
<code>
package src;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
     class compareDates
//          Compare two dates
public static boolean compareDates(Date dDateA, Date dDateB)
// Declare variables
GregorianCalendar cDateA = new GregorianCalendar();
GregorianCalendar cDateB = new GregorianCalendar();
// Set dates
cDateA.setTime(dDateA);
cDateB.setTime(dDateB);
// Compare
if (cDateA.get(Calendar.MONTH) == cDateB.get(Calendar.MONTH) && cDateA.get(Calendar.YEAR) == cDateB.get(Calendar.YEAR) && cDateA.get(Calendar.DAY_OF_MONTH) == cDateB.get(Calendar.DAY_OF_MONTH))
     System.out.println("Thanks");
System.out.println("Enter correct Date");
                    return false;
     //Main     
     class compare
     public static void main(String args[])
          BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
          System.out.println("Enter Start Date ");
     String dDateA=br.readLine();
     System.out.println("Enter End Date ");
     String dDateB= br.readLine();
          compareDates cd= new compareDates();
          Date ddateA;
          cd.compareDates(ddateA,dDateB);
</code>
and i am getting error in this line
cd.compareDates(ddateA,dDateB);
if any one knows plz help me

this is my error in console
javac compare.javacompares.java:46: compareDates(java.util.Date,java.util.Date) in compareDates cannot be applied to (java.lang.String,java.lang.String)
cd.compareDates(dDateA,dDateB);
suggection
in passing arguments i am passing date, but in main i am calling date as string
if u know how to rectify it plz tel me
tel me friends

Similar Messages

  • "System error: Move error" on comparing DATE rows with literal timestamps

    say, I have a table consisting of a DATE and a TIMESTAMP column:
      create table test (
      d date,
      ts timestamp
    now the problem:
    when I try to retrieve values using a statement like this (using MaxDB's SQL Studio or via JDBC):
      select * from test
      where  d >= {ts '2007-06-18 12:19:45'}
    it produces the following error:
      General error;-9111 POS(36) System error: Move error
    So, I am not able to compare DATE columns with timestamp values?
    In contrast, the following combinations all work flawlessly:
      select * from test
      where  d >= {ts '2007-06-18 12:19:45'}
      select * from test
      where ts >= {d '2007-06-18'}
      select * from test
      where  ts >= {ts '2007-06-18 12:19:45'}
    Thus, the opposite direction (comparing a TIMESTAMP column to a literal date value) apparently poses no problem to the MaxDB database engine.
    Unfortunately, I cannot just resort to "truncating" the timestamp values and using the {d ...}-Syntax, because I am using Apache's Torque object-relational mapper which generates the statement like this and feeds the JDBC API with it. Anyway, I deem this a bug in MaxDB, especially with respect to the quite obscure error message.
    I can reproduce this issue on both MaxDB 7.5 and 7.6 server, using client software (SQL Studio), version 7.5 and 7.6 as well.
    Does anybody know this problem?
    TIA,
    Alex

    Hi,
    this is a new bug and we will fix it with one of the next versions of MaxDB.
    You can watch the proceeding in our internal bug tracking system:
    http://www.sapdb.org/webpts?wptsdetail=yes&ErrorType=0&ErrorID=1151609
    Thank you for reporting it.
    Kind regards
    Holger

  • Compare date

    hi all, the below code has one error in compare date : today >= expiredate. In this program, i want to compare if today is greater than expiredate, then status = overdue write to table named totalday. thanks
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               Connection con = DriverManager.getConnection("jdbc:odbc:booking");
            PreparedStatement ps1 = con.prepareStatement("select date from totalpay");
            PreparedStatement ps2 = con.prepareStatement("update totalpay set status = 'overdue'");
            GregorianCalendar calendar= new GregorianCalenda();
               SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
               String today = df.format(calendar.getTime());
               calendar.add(Calendar.DATE, 30);
               String expiredate = df.format(calendar.getTime());
               ResultSet rs = ps1.executeQuery();
               while (rs.next()){
    //int today1 = Integer.parseInt(today);
    //int expiredate1 = Integer.parseInt(expiredate);
                   if (today >= expiredate)
              ps2.setString(3,status);
                    ps2.executeUpdate();
                   rs.close();
                   ps1.close();
                   ps2.close();
                   con.close();
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Thanks for your reply. it got no error, but the code changed status to 'overdue' at all fields of status include the date '30/04/2004. is the code something wrong??Thanks
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               Connection con = DriverManager.getConnection("jdbc:odbc:booking");
            PreparedStatement ps1 = con.prepareStatement("select date from totalpay");
            PreparedStatement ps2 = con.prepareStatement("update totalpay set status = 'overdue'");
            // milliseconds in a day.
            final long DAY = 24L * 60 * 60 * 1000;
            // date format of the SQL field.
            final SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
            // today as a date.
            final long today = System.currentTimeMillis() / DAY;
            // assuming the expiry is 30 days from today.
            final long expiryDay = today + 30;
                    final ResultSet rs = ps1.executeQuery();
                    while (rs.next()) {
                final String recDateString = rs.getString("date");
                final long recDate = df.parse(recDateString).getTime() / DAY;
                if (recDate >= expiryDay)
                    ps2.setString(3, status);
                ps2.executeUpdate();
                   rs.close();
                   ps1.close();
                   ps2.close();
                   con.close();
                JOptionPane.showMessageDialog(this,"Status updated.");
                   MainMenu mm = new MainMenu();
                    this.setVisible(false);  //close frame
                    mm.setVisible(true);
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • DB Connect Load - "Unknow error while uploading data from the DB Table"

    Hi Experts,
    We have our BI7 system connected to Oracle DB based third party tool. The loads are performing quite well in DEV environment.
    I would like to know, how we transport DB Connect datasources to Quality systems? Any different process to be followed for DB Connect datasources?
    At present the connections between BI Quality and the third party quality systems are established. We transported the DataSource from BI DEV system to BI quality system, but on trigerring an infopackage we are not able to perform loads. It prompts - "Unknow error while uploading data from the DB Table".
    Also on comparing the DataSources in DEV system and Quality system there are no fields in "Proposal" tab of datasource in Quality system. Also I cannot change or activate Datasource in Quality system as we dont have change access in quality.
    Please advice.
    Thanks,
    Abhijit

    Hi,
    Sorry for bumping an old thread ....
    Did this issue get ever get resolved?
    I am facing the same one. The loads work successfully in Dev. The transport for DBConnect DS also moved in successfully.
    One strange this is that DB User for dev did not automatically change to db user from quality when I transported the DBConnect datasource. DBCon DS still shows me the DB User from Dev in Quality system
    I get "Unknown Error" whenever I trigger the data package.
    Advait

  • Error in the Data Transfer phase

    Dear all,
    During the Data Transfer phase, we get 117 errors.
    The error for each failed process is:
    Execution of program /1CADMC/OLC_500000000043327 failed, return code               3
    Message no. DMC_RT_MSG046
    RC = 3: Error writing the data
    I compared the table structures in source and target system, and they are the same.
    Therefore I suspect that something went wrong during the Data Selection phase.
    Does anyone else have this problem?

    Hi Nicolas,
    Error code 3 suggests that there was a problem writing data to the receiver system. This may happen due to various reasons (For example: No tablespace available in the target system). To be sure, please check the System Logs (SM21) and Error Logs (ST22).
    In oder to check if something went wrong during data selection, you may refer to the selection logs for the tables for which data transfer is aborted.
    In case you are not able to identify the issue, kindly open an OSS Message for faster resolution of the problem.
    Regards,
    Suman

  • URGENT : Error: Please create data processing function module

    Hi
    I am getting the folloiwng error
    "Please create data processing function module" in table maintainence.
    It is working fine in dev environment but not in QA and production.
    Pleae help.
    Regards
    Kalpesh

    Hi Kalpesh,
       I see it is something to do with the naming convention used in the quality and production system. These must have been setup differently compared to ur development system. So check with different naming conventions.
    Reward points if helpful.
    Cheers
    Shafiq

  • Comparing dates problem, need help?

    the checks are not working correctly, and I am missing something. Code is below.
    for the start date check.
    1. if I put in 28-OCT-2006, I get my error message. Why wont it let me enter today and how do I fix it?
    2. If the start and stop date are the same, my SAVE button code fires. WHy? and then it still ends up commiting.
    thanks,
    HERE IS THE START DATE TEXT
    SET_ITEM_PROPERTY('DRUG_ID', Enabled, PROPERTY_FALSE);
    declare
    alert_NO varchar2(10);
    startDate date;
    systemDate date;
    begin
    startDate := :DRUG_PRICE.START_DATE;
    systemDate := sysDATE;
    --this displays at the buttom of form
    -- MESSAGE('StartDate Must be >= Today');
    if(startDate < systemDate ) then
    --this displays at the buttom of form
    MESSAGE('StartDate Must be >= Today');
    --calls the appropriate alert
    alert_NO := show_alert('STARTSYS');
    RAISE FORM_TRIGGER_FAILURE;
    end if;
    end;
    HERE IS MY SAVE BUTTON
    declare
    alert_NO varchar2(10);
    startDate date;
    stopDate date;
    begin
    startDate := :DRUG_PRICE.START_DATE;
    stopDate := :DRUG_PRICE.STOP_DATE;
    --this displays at the buttom of form
    MESSAGE('Error with the Dates');
    if(startDate > stopDate ) then
    -- calls the appropriate alert
    alert_NO := show_alert('START');
    RAISE FORM_TRIGGER_FAILURE;
    elsif (startDate <= stopDate) then
    MESSAGE('Drug Price Added Successfully.');
    commit;
    end if;
    end;

    Is this forms?
    Anyway, regarding your question, you're comparing the input date against sysdate and maybe you're sending a trunc date so sysdate is always bigger (it includes day, month,year, hour, minute and seconds). Since you're sending a truncate date you're comparing now against today 12:00:00 a.m.
    Ex:
    select sysdate from dual;
    SYSDATE
    28.10.06 23:31
    select case when to_Date('28/10/2006', 'dd/mm/yyyy')<sysdate then 'a' else 'b' end FROM DUAL;
    CAS
    a

  • Error "Not all data could be changed in LC" when running DP macro

    We are getting the error, "Not all data could be changed in LC" when running DP macros and we are not sure why. It seems to only happen when we are executing it via a Process Chain but not using the DP background processing scheduling. Does anyone know why this is happening?

    Hi Stacy,
                         I hope you are seeing this in message spool.  This message comes up for various reasons. We used to see a message saying "No data saved".
    Some of the reasons could be " the new value (lets say 3 ) after the macro execution is same as after execution (3)".
    See if some of the values are fixed and could not be changed.
    I would take a selection id with just few values and execute the job for that selection id and compare the pre and after results. That should answer all your questions.

  • Error in Master Data Charecteristic number 0DOC_NUMBER.

    Hi all,
    While doing attribute change run for the master data charecteristics 0DOC_NUMBER I am getting the following error message "Error updating the data records /BI0/XDOC_NUMBER", i tried to do RSRV to find the error and repair this master data but it showed an error message again saying " Charecteristic 0DOC_NUMBER: 649,447 values from table /BI0/SDOC_NUMBER do not exist in tab" please give me some suggestions why it is happening or any SAP Note regarding this issue, here i would like to mention 0doc_number is having 39,323,812 records.
    Regards,
    Partha

    Hi,
    the fill attribute SID table will populate the X table, but this is usually not a big problem.
    But being given your input on number of records on the different tables you issue is that your are missing entries in the SID table (the S table), which is a serious issue: it means that some master data IDs (your document number) doesn't have their corresponding SID.
    As you may know, this link is vital when you use this IOBj in ICubes since it is the SID which is posted in the Dimension table. Having this link broken would produce inacurate results in reporting for the affected documents (they will purely not show up).
    I would investigate which Master data IDs have no SID: this can be done in RSRV / elementary test / master data / Compare characteristic values in SID/P/and Q tables for characteristic.
    Please let us know how this test goes; another issue is the number of records in this IObj....
    Then you'll need to perform a where used list on 0DOC_NUMBER and compile the cubes using it.
    Let me know how it goes....
    Olivier.

  • Comparing data in the database with the input text

    hi there i have problem with the comparing data in the database with the input text. here is the piece of code of mine:
    //declaration
    datasourcedb.connect();
    String stcode = req.getParameter("txtCode");
    ResultSet rs = null;
    String action = req.getParameter("action");
    ResultSet portquery = null;
    if (action.equals("SELL"))
    -->portquery = datasourcedb.query("SELECT stockcode FROM portfolio where stockcode =\'"+ stcode + "\'");
    -->portquery.next();
    -->if((portquery.wasNull()) == true)
    disp = req.getRequestDispatcher("error.jsp"); }
    else */
    Status = "Sell";
    datasourcedb.close();
    with the code that i marked with --> it doesnt work since i have to compare the input text stcode with stockcode in the db. could anyone tell me how to compare it?
    regards
    virginia

    i have try to change into this code:
    if (action.equals("SELL"))
    portquery = datasourcedb.query("SELECT distinct stockcode FROM portfolio where stockcode =\'"+ stcode + "\' + and userName = \'"+ user + "\'");
    if(portquery.next()) {
    Status = "Sell";}
    else {               
    disp = req.getRequestDispatcher("error.jsp");
    but so far the coding doesnt give any result.... could anyone help me? since the coding does not reach status n the disp

  • Compare Date Modified on OneDrive and LocalStorageFile

    I can't find an easy way to compare two files
    When uploading (CreateBackgroundUploadAsync) file from LocalStorage to Onedrive the Modified Date kind of appearing is changed since it become a place holder and not the real file.
    How can I compare Date Modified (updated_time is NOT the real Modifed Date) and also I would not like to download file back to either the phone or Desktop as it good be lengthy.
    I should only download/upload files which are different. Basically just to synchronize files.
    Thanks

    Hi,
    Based on my research, the Date Modified changed could be due to corrupt Update Sequence Number Journal. The USN Journal is a feature of NTFS which maintains a record of changes made to the volume. 
    You could try to refer to article below to check if it could resolve the issue.
    Error messages when you try to gain access to an NTFS volume
    http://support.microsoft.com/kb/311724
    Best Regards,
    Mandy
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • FILTER EXPRESSION COMPARING DATA TYPES

    Hi,
    I am recieving an error when running my report. I added a filter expression to my chart which only shows data > 24 hours but I am receiving the following error... can anybody help me?
    CANNOT COMPARE DATA OF TYPES SYSTEM.DECIMAL AND SYSTEM.DOUBLE

    Hi Irj1985,
    Based on the error message, we can know that the data type of the two values are different. One of them is decimal, another of them is double.
    To trouble this issue, please refer to the steps below.
    Ensure that the issue was cause by the filter.
    Convert the data type of one of the value to the data type of another value.
    If the issue persists, please elaborate the issue, provide the detail information about the fitler and your report, so that we can make further analysis.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Error while insert data using execute immediate in dynamic table in oracle

    Error while insert data using execute immediate in dynamic table created in oracle 11g .
    first the dynamic nested table (op_sample) was created using the executed immediate...
    object is
    CREATE OR REPLACE TYPE ASI.sub_mark AS OBJECT (
    mark1 number,
    mark2 number
    t_sub_mark is a class of type sub_mark
    CREATE OR REPLACE TYPE ASI.t_sub_mark is table of sub_mark;
    create table sam1(id number,name varchar2(30));
    nested table is created below:
    begin
    EXECUTE IMMEDIATE ' create table '||op_sample||'
    (id number,name varchar2(30),subject_obj t_sub_mark) nested table subject_obj store as nest_tab return as value';
    end;
    now data from sam1 table and object (subject_obj) are inserted into the dynamic table
    declare
    subject_obj t_sub_mark;
    begin
    subject_obj:= t_sub_mark();
    EXECUTE IMMEDIATE 'insert into op_sample (select id,name,subject_obj from sam1) ';
    end;
    and got the below error:
    ORA-00904: "SUBJECT_OBJ": invalid identifier
    ORA-06512: at line 7
    then when we tried to insert the data into the dynam_table with the subject_marks object as null,we received the following error..
    execute immediate 'insert into '||dynam_table ||'
    (SELECT

    887684 wrote:
    ORA-00904: "SUBJECT_OBJ": invalid identifier
    ORA-06512: at line 7The problem is that your variable subject_obj is not in scope inside the dynamic SQL you are building. The SQL engine does not know your PL/SQL variable, so it tries to find a column named SUBJECT_OBJ in your SAM1 table.
    If you need to use dynamic SQL for this, then you must bind the variable. Something like this:
    EXECUTE IMMEDIATE 'insert into op_sample (select id,name,:bind_subject_obj from sam1) ' USING subject_obj;Alternatively you might figure out to use static SQL rather than dynamic SQL (if possible for your project.) In static SQL the PL/SQL engine binds the variables for you automatically.

  • Error while updating data from PSA to ODS

    Hi Sap Gurus,
    I am facing the error while updating data from PSA to ODS in BI 7.0
    The exact error message is:
    The argument 'TBD' cannot be interpreted as a number
    The error was triggered at the following point in the program:
    GP44QSI5RV9ZA5X0NX0YMTP1FRJ 5212
    Please suggest how to proceed on this issue.
    Points will be awarded.

    Hi ,
    Try to simulate the process.That can give you exact error location.
    It seems like while updating few records may be no in the format of the field in which it is updated.
    Regards
    Rahul Bindroo

  • 'Error while signing data-Private key or certificate of signer not availabl

    Hello All,
    In my message mapping I need to call a web service to which I need to send a field value consist of SIGNED DATA.
    I am using SAP SSF API to read the certificate stored in NWA and Signing the Data as explained in
    http://help.sap.com/saphelp_nw04/helpdata/en/a4/d0201854fb6a4cb9545892b49d4851/frameset.htm,
    when I have tested using Test tab of message mapping  it is working fine and I am able to access the certificate Keystore of NWA(we have created a keystore view and keystore entry to store the certificate) and generate the signed data ,but when I test end to end scenario from ECC system,it is getting failed in mapping with the error
    ' Error while signing data - Private key or certificate of signer not availableu2019.
    Appreciate your expert help to resolve this issue urgently please.
    Regards,
    Shivkumar

    Hi Shivkuar,
    Could you please let me know how you were trying to achieve the XML signature.
    We have a requirement where we have to sign the XML document and need to generate the target document as following structure.
    <Signature>
         <SignedInfo>
             <CanonicalizationMethod />
             <SignatureMethod />
             <Reference>
                     <Transforms>
                     <DigestMethod>
                     <DigestValue>
             </Reference>
        <Reference /> etc.
      </SignedInfo>
      <SignatureValue />
      <KeyInfo />
      <Object>ACTUAL PAYLOAD</Object>
    </Signature>
    I am analyzing the possibility of using the approach that is given in the help sap link that you have posted above. Any inputs will be apprecited.
    Thanks and Regards,
    Sami.

Maybe you are looking for

  • A problem with a parameter name.(% causing problems)

    Hello, I wrote a following sql query and it works fine except for parameters like drying%Total, drying%,. The reason is that in the name of parameters there is a wildcard used %. I know that I can use an escape command however I could not figure out

  • Reinstalling acrobat 8 pro via ftp link from adobe??

    Hi, I need some help in reinstalling acrobat8, I did the trial on acrobat 9. I had to unistall 8. The people at adobe sent me a FTP link to reinstall 8 as I have misplaced my 8 disk. I can't get the download to start from  the link that was emailed t

  • Armenian Mshtakan font not working in MS Word

    Hello, I am able to use the Armenian Mshtakan font on a Macbook pro using OS 10.7.5 only in Text Edit.  It will not work in MS Word. Is there any way to get Mshtakan font to work in MS Word for Mac?  Currently using MS Office 2011. Microsoft's websit

  • Problem when querying OLAP for Value based hierarchy

    Hi I have problem when querying OLAP for value based hierarchy , for level based dimension it work fine the strange part is if I only put one value, it will work perfectly for example if I put only 1 value for that value base hierarchy like CF_HIER::

  • Problems locating assignments using InCopy/InDesign CS5

    We have recently introduced an InDesign/InCopy CS5 workflow into our studio. We've come up against a big problem we are hoping someone can shed some light on. 1. We make an Assignment and package for InCopy. 2. The InCopy user edits, checks back in.