How to compare two dates that should not exceed morethan 3 years

hi all,
can you please tell me how to compare two dates( basically dates are string type)
that should not exceed more than 3 years? in JAVASCRIPT
Thanks in Advance.

This is not a JavaScript forum.
[*Google* JavaScript Forum|http://www.google.co.uk/search?q=JavaScript+Forum&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a]
Good luck.

Similar Messages

  • How to Compare two Dates in java

    How to Compare two Date Field after getting the values from jTextField1.getText() and jTextField2.getText().

    Date d1=DateFormat.getDateInstance().parse(yourstring1);
    same for d2
    d1.compareTo(d2);
    could be that i misrememberd the exact naems of some functions or mixed up something in the equence of d1=

  • How to compare two dates to know which one is greater than oher?

    how to compare two dates to know which one is greater than oher?
    Please search before asking basic questions.
    Edited by: Rob Burbank on Mar 27, 2009 9:26 AM

    Hi,
    If thse to date fields are of same type u can directly compare like this.
    regards,
    Bharat.

  • How to compare two dates

    Hi,
    I have two colums(start date &end date) of data type date in my page and both are optional ones.
    I need to have a validation on those date columns,
    End date should not be greater than Start Date.
    This validation should be triggered once i click on Apply button.
    Pseudo Code:
    If (endate>startdate)
    raise form_trigger_failure;
    Can anyone suggest how/where to implement the code, if possible please provide the sample code.
    Thanks,
    Mahesh

    sorry, I was thinking java and not oaf
    there is similar thing thats done in tutorials exercise create page part2
    this is the code snippet from jdev guide...but you may want to go through the chapter before you put this code in your EO file.
    Step 10.2 Add a validateEndDate() method Add the following new method to your EmployeeEOImpl class. /*
    * Verifies that the employee's End Date is valid.
    * Business Rules:
    * This is an optional value which can be updated at any time.
    * Cannot be earlier than sysdate.
    protected void validateEndDate(Date value)
    // If a value has been set, validate it.
    if (value != null)
    OADBTransaction transaction = getOADBTransaction();
    // Note that we want to truncate these values to allow for the possibility
    // that we're trying to set them to be the same day. Calling // dateValue( ) does not include time. Were we to want the time element,
    // we would call timestampValue(). Finally, you cannot compare
    // oracle.jbo.domain.Date objects directly. Instead, convert the value to
    // a long as shown.
    long sysdate = transaction.getCurrentDBDate().dateValue().getTime();
    long endDate = value.dateValue().getTime();
    if (endDate < sysdate)
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    "EndDate", // Attribute Name
    value, // Attribute value
    "AK", // Message product short name
    "FWK_TBX_T_END_DATE_PAST"); // Message name
    } // end validateEndDate()

  • How to compare two date Objects

    Hi,
    I have two Calendar Objects, one is coming from client and one is my server time, I need to evaluate that incoming time with server time so that if it is sent before an hour back then i should not do anything on that request Object. I have converted the incoming String into Calendar Object and how can i evaluate these two Calendar Objects including their hours and minutes.
    Thanks in advance
    bajju

    bajjurireddy, ignore Mobiquity's post. It contains no useful information and will only serve to confuse and frustrate you.
    Mobiquity wrote:
    Also make sure that the two date objects are in the same date format..
    public static String DateToDateString(java.util.Date d, String dateFormat)
         throws ParseException {
              SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
              sdf.setLenient(false); // this is required else it will convert
              String dateString = sdf.format(d);
              return dateString;

  • How to compare two files in java & uncommon text should print in text file.

    Hi,
    Can any one help me to write Core java program for this.
    How to compare two files in java & uncommon text should print in other text file.
    thanks
    Sam

    Hi All,
    i m comparing two HTML file.. thats why i am getting problem..
    import java.io.BufferedReader;
    import java.io.FileReader;
    public class textmatch{
    public static void main(String[] argv)
    throws Exception{
    BufferedReader fh =new BufferedReader(new FileReader("internal.html"),1024);
    BufferedReader sh = new BufferedReader(new FileReader("external.html"),1024);
    String s;
    String y;
    while ((s=fh.readLine())!=null)
    if ( s.equals(y=sh.readLine()) ){    
    System.out.println(s + " " + y); //REMOVE THIS PRINTLN STATEMENT IF YOU JUST WANT TO SHOW THE SIMILARITIES
    sh.close();
    fh.close(); }
    thanks
    Sam

  • How to compare two files in Java & uncommon text should print in Diff text

    Hi All,
    can any one help me to write a java program..
    How to compare two files in Java & uncommon text should print in Diff text file..
    Thanks
    Sam

    Hi All,
    i m comparing two HTML file.. thats why i am getting problem..
    import java.io.BufferedReader;
    import java.io.FileReader;
    public class textmatch{
    public static void main(String[] argv)
    throws Exception{
    BufferedReader fh =new BufferedReader(new FileReader("internal.html"),1024);
    BufferedReader sh = new BufferedReader(new FileReader("external.html"),1024);
    String s;
    String y;
    while ((s=fh.readLine())!=null)
    if ( s.equals(y=sh.readLine()) ){    
    System.out.println(s + " " + y); //REMOVE THIS PRINTLN STATEMENT IF YOU JUST WANT TO SHOW THE SIMILARITIES
    sh.close();
    fh.close(); }
    thanks
    Sam

  • HOW WE CAN VALIDATE A FIELD THAT SHOULD NOT BE SPECIAL CHARACTER?

    HOW WE CAN VALIDATE A FIELD THAT SHOULD NOT BE SPECIAL CHARACTER?

    data : v_abcde like sy-abcde,
             v_num like '0123456789',
              v_data(60) type c.
    start-of-selection.
    v_abcde = sy-abcde.
    concatenate v_abcde v_num into v_data.
    if ur field co v_data
    else.
    message.
    endif.

  • How to put condition for one date range should not interfear with another ?

    hi friends,
    how to put condition for one date range should not interfear with another  date range.
    my data base table has two fields
    from date
    to date.
    when we enter the date range in the data base , new date range means from date and to date should not interfear.
    can  anybody help me.
    thanks &Regards,
    Revanth
    Edited by: rk.kolisetty on Jul 1, 2010 7:18 PM

    Do it the SAP way....
    First entry...from is today, to is 99991231.
    New dates entered, now we have two rows...:
        from is original date  to becomes yesterday.
        From is today          to is 99991231

  • How to compare two rows from two table with different data

    how to compare two rows from two table with different data
    e.g.
    Table 1
    ID   DESC
    1     aaa
    2     bbb
    3     ccc
    Table 2
    ID   DESC
    1     aaa
    2     xxx
    3     ccc
    Result
    2

    Create
    table tab1(ID
    int ,DE char(10))
    Create
    table tab2(ID
    int ,DE char(10))
    Insert
    into tab1 Values
    (1,'aaa')
    Insert
    into tab1  Values
    (2,'bbb')
    Insert
    into tab1 Values(3,'ccc')
    Insert
    into tab1 Values(4,'dfe')
    Insert
    into tab2 Values
    (1,'aaa')
    Insert
    into tab2  Values
    (2,'xx')
    Insert
    into tab2 Values(3,'ccc')
    Insert
    into tab2 Values(6,'wdr')
    SELECT 
    tab1.ID,tab2.ID
    As T2 from tab1
    FULL
    join tab2 on tab1.ID
    = tab2.ID  
    WHERE
    BINARY_CHECKSUM(tab1.ID,tab1.DE)
    <> BINARY_CHECKSUM(tab2.ID,tab2.DE)
    OR tab1.ID
    IS NULL
    OR 
    tab2.ID IS
    NULL
    ID column considered as a primary Key
    Apart from different record,Above query populate missing record in both tables.
    Result Set
    ID ID 
    2  2
    4 NULL
    NULL 6
    ganeshk

  • How to have a web-based interface for Lumira that also performs Ad-Hoc visualizations on data that should be loaded live from HANA.

    How to have a web-based interface for Lumira that also performs Ad-Hoc visualizations on data that should be loaded live from HANA. I have another tool that puts data into HANA, So don't want to reload this new data into Lumira every time I want to run a report.
    so do i  have the ability to create polished ad hoc dashboards, reports, infographics and storyboards Apart from Ad-Hoc reports, I also need a dashboard with some fixed reports that update with the live data.
    So please suggest me to accomplish this task.
    Thanks and regards
    Shashi kiran

    Please have a look at Ludek's document here which contains links: SAP Lumira Family Supported Versions Matrix
    Ludek has also attached the PAM's as zipped files; Lumira comes in many flavors so I encourage you to research options
    Also see this "HANA Live" document: [SAP HANA Academy] Visualized: Lumira & HANA

  • HT3275 how can i retrieve information from  time machine if my computer has less storage capacity? How can I access data that is on my time machine but can not be copied to a computer with less storage capacity? I used to have 180 GB, now I have 128 GB.

    how can i retrieve information from  time machine if my computer has less storage capacity? How can I access data that is on my time machine but can not be copied to a computer with less storage capacity? I used to have 180 GB, now I have 128 GB.

    Plug an external drive into the computer and use that to expand data onto.
    http://pondini.org/TM/16.html

  • How to compare two Objects !!!!

    Hi All,
    I know that this question has been asked 100 times till now. But trust me I have checked all of them but couldn`t find answer. Here is my question:
    I have an objecs. In that object I am setting (Id,Name,DOJ). Now I want to check whether the object I am trying to save in database already exists or not. If exists then I need to check whether all the setters are same for the two objects. Now can anyone tell me ,how to compare two objects directly without comparing the setters individually.
    Thanks in advance.

    pavan13 wrote:
    That is pretty good idea. However I have a query. Does that code actually compare all the setters in a two beans. I don`t want to check each setter seperately.Well, it's pretty meaningless to talk about "comparing setters", setters are methods, they don't have values to compare. Because equals is inside the class, you can simply compare the fields that get set by the setters. "Properties" is probably a better name.
    In principal you could write something that tried to find all relevant fields and compare them, using reflection or bean info stuff. The resulting code would be about 50 times longer and take about 50 times longer to run. It's hardly asking a lot to put three comparisons between && operators.
    Remember, though, not to compare string fields with ==, you should call .equals on the string fields.
    p.s. don't let the bean terminology confuse you. Beans are just ordinary objects which follow a few rules. Personally I wish the term had never been coined.
    Edited by: malcolmmc on Dec 6, 2007 4:15 PM

  • How to compare two strings whether both are equal while ignoring the difference in special characters (example: & vs & and many others)?

    I attempted to compare two strings whether they are equal or not. They should return true if both are equal.
    One string is based on Taxonomy's Term (i.e. Term.Name) whereas other string is based on String object.
    The problem is that both strings which seem equal return false instead of true. Both string values have different special characters though their special characters are & and &
    Snapshot of different design & same symbols:
    Is it due to different culture or language?
    How to compare two strings whether both are equal while ignoring the difference in special characters (& vs &)?

    Hi Jerioon,
    If you have a list of possible ambiguous characters the job is going to be easy and if (& vs &) are the only charracters in concern awesome.
    You can use the below solution.
    Before comparing pass the variables through a replace function to standarize the char set.
    $Var = Replace($Var,"&","&")
    This is going to make sure you don't end up with ambiguous characters failing the comparison and all the char are "&" in this case.
    Similar technique is used to ignore Character Cases 'a' vs. 'A'
    Regards,
    Satyajit
    Please “Vote As Helpful”
    if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

  • ??how to compare two resultsets??

    hi all!
    i need to find out whether two resultsets contain the same data.
    the only way i know how to do it in java is to put them into a while loop and fetch the contents first and then compare the contents.
    but is there an easier way to compare resultsets?
    does anyone know how to compare two resultsets without extracting the data?
    the code example here executes two identical queries on an oracle database, compare and print the resultsets.
    public ResultSet getResultset(String query)
    ResultSet rs=null;
    try { rs=Stmt.executeQuery(query); }
    catch(Exception e) { e.printStackTrace(); }
    return rs;
    public static void main(String[] args) {
    ResultSet r1=null;
    ResultSet r2=null;
    try {
    database db = new ddatabase();
    r1=db.getResultset("Select 'name' from person");
    r2=db.getResultset("Select 'name' from person");
    if (r1 == r2) {
    System.out.println("ok");
    System.out.print(r1);
    System.out.println();
    System.out.print(r2);
    else {
    System.out.println("not ok");
    System.out.print(r1);
    System.out.println();
    System.out.print(r2);
    jdbc.cleanup();
    catch(Exception e) {e.printStackTrace();}
    and here is the output:
    F:\java rs_compare
    not ok
    oracle.jdbc.driver.OracleResultSetImpl@4413ee
    oracle.jdbc.driver.OracleResultSetImpl@786e64
    as you can see the resultsets are different though the data they contain have to be the same.
    so the 'if(resultset#1 == resultset#2)' does not work.
    thanks for any help
    best regards
    5ithl0rd

    Don't cross-post.
    I'll bet ResultSet implementations don't override equals() to provide "deep equals" behavior, in which case it'll be no different than using "==".
    It's a bad idea to compare two ResultSets this way. You'll have to load both into objects or data structures and compare those in a "deep" way.
    Besides, the ONLY way two ResultSets could be different, given the same query, would be if there were multiple clients that could write to the table between queries and change the underlying data. If your two queries are sufficiently isolated, I'd say that the same query will return the same ResultSet.
    %

Maybe you are looking for