Compare 2 dates - LC ES ver 8.2

Hello,
This may seem to be a very elementary questions but I am missing something that I have not been able to identify and am asking for anyone's assitance with this.
In my form I am comparing two dates (<Date1> and <Date2>).  If <Date2> is less that <Date1> I would like to display a message box and then set the focus to <Date1>.
I have tried numerous variations using Date2Num and .Rawvalue but the code seems to be skipping the IF THEN statement and goes directly to displaying the message.  On Exit from the <Date2> field the message box appears regardless if the date is less than, equal to, or greater than <Date1.
Here is the code...
topmostSubform.Page1.<Date2>::exit - (FormCalc, client)
if 
(Date2Num(<Date2>,"DD-MMM-YY") < Date2Num(<Date1>,"DD-MMM-YY")) then
xfa.host.messageBox("<<< CAUTION >>> Your <Date2> cannot be earlier than your <Date1>. Please correct your <Date1> date. Thank You")
xfa.host.setFocus("<Date1>")
Endif
Thanks.
TST

When referencing an object you do not use <Date1> ....you woudl use the name of the field and a method or property. In your case ....assuming the field is called Date1 then you woudl use Date1.rawValue
Paul

Similar Messages

  • How to compare delivery date in schedule lines and PGI in outbound delivery

    Hi,
    I want to create a report to monitor and compare different dates in sales and delivery process.
    One of my key figure is the comparison between date confirmed to the customer, that I can find in the schedule line of the sales order, and the actual goods issue date from the outbound delivery.
    But I can't succeed in making the link between delivery and schedule lines, means between LIKP and VBEP.
    Would you have any idea?
    Thank you.

    It seems there's no exact (table) connection / link between delivery item and schedule line item.
    Those who were searching for this thing (link / connection between delivery item and schedule line) were recommended to use FM "RV_SCHEDULE_CHECK_DELIVERIES".
    This FM calculates the delivered quantity for each schedule line, so it makes link between the delivery item and schedule lines - however if you check the code it's quite sophisticated...
    (if you put a breakpoint in the FM and display a SO in VA03, you can check how the parameters have to be populated with data).
    Schedule Line and Delivery Link
    Edited by: Csaba Szommer on Aug 5, 2011 12:03 AM

  • How to compare 2 dates in a JPA QL query

    hello all,
    how can i compare 2 dates in JPA QL ,?
    my idea was to convert the dates to String, and i used 'to_char',
    but i think it doesn't work in JPA QL;
    this is my query(it works in oracle but not in java) :
    Query q=em.createQuery("select sum(o.montant) from Operation o join o.codTransac t join o.codCaisse c where (t.sens='D')and (to_char(c.dateCaisse,'MM/DD/YYYY')=to_char(o.dateOp,'MM/DD/YYYY'))");
    can some one help me?
    thanks

    I don´t know if it´s the same case, but I had a similar problem and I`m posting here the way I solved it (maybe it isn´t the best solution but worked to me).
    I have to compare a date come from a web form (format dd/mm/yyyy) with a Timestamp data from DB (dd/mm/yy hh24:mi:ss).
    Solution:
    //String dateTo from web form
    //Substring here were used to get only dd/mm/yy from DB and ignore the hours
    ql.append(" SELECT o FROM Table o WHERE SUBSTRING(o.dateTime,1,8) = :end ");
    q = getEntityManager().createQuery(ql.toString());
    q.setParameter("end",convertStringToDateSimple(dateTo));
    //function used to parse the String date and return in an appropriate format expected in the above query
    public static String convertStringToDateSimple (final String source)
         final SimpleDateFormat format = new SimpleDateFormat("dd/MM/yy");
              String parsed = null;
                   try
                        parsed = format.format(format.parse(source));
                   catch (ParseException e)
                        throw new RuntimeException(e);
              return parsed;
    Edited by: user8947239 on 31/10/2011 10:58

  • How to compare 2 dates in SQL Server 2000 DB using Java?

    How do you compare 2 dates in SQL Server 2000 DB using Java?
    Let's say we have two fields: Date Reported and Target Finish Date.
    Date Reported is 09-10-2004 09:55:55: PM
    Target Finish Date is 09-12-2004 11:59:59: PM
    What i want to happen is i want to convert both dates to days and get the difference of the two.
    can SQL Server 2000 DB do this?

    it doesnt wrk.
    ok here's what i did:
    iv tested a simple code for this case.
    I created a table name tblDate which has 3 columns namely date_ID, date_From (datatype datetime), date_To (datatype datetime).
    I inserted 1 row: date_ID has the value 1, date_From has the value 10/22/2004, and date_To has the value 10/24/2004.
    i run the java code below:
    int days = 0;
              String query = "SELECT date_From, date_To cast(date_From-date_To AS int) AS Diff FROM tblZoo WHERE date_ID = '1'";
              try
                   DBConnect db = new DBConnect();
                   db.openCon();
                   ResultSet rs = db.execute(query);
                   while(rs.next())
                        days = rs.getInt("Diff");
                   db.closeCon();                         
              catch (Exception ex)
                   System.out.println("Error on Execution: " + ex);
              return days;___________
    an error occurred: Error on Execution: java.lang.nullpointerexception

  • ABAP HR: Program that will compare HR Data from System GH* and GO*

    Hi ABAP Gurus,
    Good day.
    I have a requirement wherein I need to create an HR Report Program (using logical database PNP) and RFC FM wherin I will select and then compare HR Data in GH* and GO* system.  This enhancement will be done in the GH* system. 
    Do you guys have any documentation, sample programs on how to proceed with this?   Any inputs on this will be highly appreciated.
    Thank you very much!
    Best regards.
    Brando Braganza
    Moderator message - Duplicate post locked
    Edited by: Rob Burbank on May 12, 2009 12:09 PM

    HI,
      your code works perfectly well.. I have added the PNP logical database and selection screen 100... i think you r not added this PNP logical database
    *& Report  ZTESTPRG                                                    *
    REPORT  ZTESTPRG                                .
    TABLES: PERNR.
    INFOTYPES: 0002, 0006.
    GET PERNR.
      PROVIDE * FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA.
        WRITE: P0002-PERNR, P0002-NACHN, P0002-VORNA.
      ENDPROVIDE.
    Thanks
    mahesh

  • How to compare current date with past date

    Sample code for comparing current date with past date
    i dont want to Calender.set method to compare it.
    How can i do it?

    PLEASE stay with ONE thread:
    http://forum.java.sun.com/thread.jspa?threadID=5143991&tstart=0

  • Compare two dates in a report

    Hi,
    I would like to compare two dates on a report.
    I would like to compare the opportunity created date and the opportunity modified date. I can't use this formula CASE WHEN Opportunity."Last Modified" = Opportunity."Created Date" then 1 else 0
    I think I have to use TIMESTAMPDIFF but I don't know which interval I have to put to analyze the entire date in this format 31/12/1999 16:49:08
    Thanks a lot for your help
    Regards,

    Hi !
    It depends on the interval you need to compare these dates. If you want to know the number of days between these dates, you'll have to use SQL_TSI_DAY as interval. If it's minutes, you'll need SQL_TSI_MINUTE...
    Here are the possible intervals :
    *SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, or
    SQL_TSI_YEAR*
    Hope this will help, feel free to ask more !
    Max

  • Compare two dates in different format.

    Hi
    I want to compare two dates....one of which is in the timeStamp format ("yyyy-MM-dd HH:mm:ss")
    and the other is in java.util.Date i.e Tue Oct 11 10:22:47 GMT+05:30 2005
    Do I have to tokenise and then compare them.Is there any better approach?
    I want to find out which is greater/smaller one.
    Pls help.
    Regards,
    Sandip.

    I would convert both to Date and compare them. To convert String to Date check java.text.SimpleDateFormat and its parse(...) method.
    HTH
    Mike

  • Comparing SQL Data Results with CSV file contents

    I have the following scenario that I need to resolve and I'm unsure of how to approach it. Let me explain what I am needing and what I have currently done.
    I've created an application that automatically marks assessments that delegates complete by comparing SQL Data to CSV file data. I'm using C# to build the objects required that will load the data from SQL into a dataset which is then compared to the
    associated CSV file that contains the required results to mark against.
    Currently everything is working as expected but I've noticed that if there is a difference in the number of rows returned into the SQL-based dataset, then my application doesn't mark the items at all.
    Here is an example:
    ScenarioCSV contains 4 rows with 8 columns of information, however, let's say that the delegate was only able to insert 2 rows of data into the dataset. When this happens it marks everything wrong because row 1 in both CSV and dataset files were correct,
    however, row 2 in the dataset holds the results found in row 4 in the CSV file and because of this it is comparing it against row 2 in the CSV file.
    How can I check whether a row, regardless of its order, can be marked as it does exist but not in the same order, so I don't want the delegate to lose marks just because the row data in the dataset is not perfectly in the same order of the row data
    in the CSV file???
    I'm at a loss and any assistance will be of huge help to me. I have implemented a ORDER BY clause in the dataset and ensured that the same order is set in the CSV file. This has helped me for scenarios where there are the right number of rows in the dataset,
    but as soon as there is 1 row that is missing in the dataset, then the marking just doesn't allow for any marks for both rows even if the data is correct.
    I hope I've made sense!! If not, let me know and I will provide a better description and perhaps examples of the dataset data and the csv data that is being compared.
    Thanks in advance....

    I would read the CSV into a datatable using oledb. Below is code I wrote a few weeks ago to do this.
    Then you can compare two datatables by a common primary key (like ID number)
    Below is the webpage to compare two datatables
    http://stackoverflow.com/questions/10984453/compare-two-datatables-for-differences-in-c
    You can find lots of examples by perform following google search
    "c# linq compare two dattatable"
    //Creates a CSVReader Class
    public class CSVReader
    public DataSet ReadCSVFile(string fullPath, bool headerRow)
    string path = fullPath.Substring(0, fullPath.LastIndexOf("\\") + 1);
    string filename = fullPath.Substring(fullPath.LastIndexOf("\\") + 1);
    DataSet ds = new DataSet();
    try
    if (File.Exists(fullPath))
    string ConStr = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}" + ";Extended Properties=\"Text;HDR={1};FMT=Delimited\\\"", path, headerRow ? "Yes" : "No");
    string SQL = string.Format("SELECT * FROM {0}", filename);
    OleDbDataAdapter adapter = new OleDbDataAdapter(SQL, ConStr);
    adapter.Fill(ds, "TextFile");
    ds.Tables[0].TableName = "Table1";
    foreach (DataColumn col in ds.Tables["Table1"].Columns)
    col.ColumnName = col.ColumnName.Replace(" ", "_");
    catch (Exception ex)
    MessageBox.Show(ex.Message);
    return ds;
    jdweng

  • How to compare 2 dates, on date and on time

    Hi,
    Can anyone explain me how I can compare 2 dates!
    I can compare them by date, but not by time.
    For example:
    Date1 = '2003-07-25 16:50:15.0'
    Date2 = '2003-07-25 14:20:48.0'
    I want to get the dates that are bigger than the date '2003-07-25 15:30:57.0', but I don't get any result.
    Normally I must get Date1 as result.
    This is because only the date is compared, not the time.
    If I ask the dates bigger than '2003-07-24 14:35:31.0' I get Date1 and Date2 as result!
    I want all the data where the foto_crea_date is bigger than the given date.
    I do this in my where-clause as followed:
    TO_CHAR(FOTO_CREA_DATE,'yyyy-MM-dd hh:mm') > '2003-07-24 06:10:15.0'
    and it works just fine for the dates, not for the time
    I hope someone can help me!!

    Hi,
    I tried to use to_date instead of to_char but than I get the following error!
    Return Error Message: JBO-27122: SQL error during statement preparation.
    Statement: SELECT FotoMain.FOTO_ID, FotoMain.FOTO_CDCM, FotoMain.FOTO_CONF, FotoMain.FOTO_COMP, FotoMain.FOTO_CLIENT, FotoMain.FOTO_CLIENT_GROUP, FotoMain.FOTO_DESCRIPTION, FotoMain.FOTO_PUBL, FotoMain.FOTO_PUBL_SITE, FotoMain.FOTO_ECMA_ID, FotoMain.FOTO_CREA_DATE, FotoMain.FOTO_EXCL, FotoMain.FOTO_MRKT, FotoMain.FOTO_ID || ', ' || FotoMain.FOTO_DESCRIPTION AS VIEW_ATTR FROM FOTO_MAIN FotoMain WHERE (FOTO_CREA_DATE >= TO_DATE('2003-07-24 16:15','yyyy-MM-dd hh:mm')) ORDER BY FOTOMAIN.FOTO_ID
    Error Message: ORA-01810: format code appears twice
    If tried also something else and it works just fine for the dates but still not with the time.
    I tried it as followed:
    String last = "2003-07-24 16:15";
    String wherelastlogin="TO_CHAR(FOTO_CREA_DATE,'yyyy-MM-dd hh:mm') >= '" + last + "'";
    Can anyone help me because I need to compare also the time?!

  • Howto: comparing 2 dates and getting the seconds

    By comparing 2 dates I need to extract or get somehow the elapsed seconds. I need to get only
    the seconds.
    Dates are in this format "hh:mm:ss"
    I tried with Date and GregorianCalendar but I couldnt get the desired result.
    Can someone provide me with a sample code please.

    remus.dragos wrote:
    Its not broken, nor absurd or complicated. I only need resolution only for minutes. The method that I use does not need to know more than 20 seconds.
    But I added minutes knoledge aniway. As you can see its easy to add hour resolution if needed. But I didnt needed it so thats why I took that approach.
    This looks cleaner for you? I just wrote it here, untested, but should work.
    public int returnSeconds(Calendar c1, Calendar c2)
    int mins =  c1.get(Calendar.MINUTES) - c2.get(Calendar.MINUTES);
    int secs =  c1.get(Calendar.SECONDS) - c2.get(Calendar.SECONDS);
    if (mins > 0) return secs+=mins;
    else            return secs;
    }And why should I treat all the time as miliseconds since the epoch. Thats an absurd afirmation without a detailed explanation.
    Edited by: remus.dragos on Apr 30, 2008 6:18 AM- Unnecessary creation of expensive Calendar objects.
    - Significantly slower
    - Breaks across Timezones
    - Unnecessary decision making introduces complexity
    - Introduces a bug by assuming c1 represents a time greater than c2
    - Introduces a bug by not multiplying minutes by 60 to obtain seconds.
    - Makes assumptions about the calendar system in use
    - Less maintainable because it limits the scope of time unit resolution handled by the logic
    I probably missed some more too. None of this is needed, and it is very brittle. Your problem can be solved by subtracting one fixed-point number from another. Go with es5f's approach.

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

  • Best Approach to Compare Current Data to New Data in a Record.

    Which is the best approach in comparing current data to new data for every single record before making updates?
    What I have is a table with 5,000 records that need to be updated every week with data from a data feed, but I dont want to update every single record week after week. I want to update only records with different data.
    I can think of these options:
    1) two cursors (one for current data and one for new)
    2) one cursor for new data and one varray for current data
    3) one cursor for new data and a select into for current data.
    Thanks for your help.

    I don't recommend it over merge, but in theory you could use a checksum (OWA_OPT_LOCK.checksum()) on the rows and if they differ then copy the new row into the destination table. Or you might be able to use rowscn to see if things have changed.
    Like I said, I don't know that I 'd take either approach over merge, but they are options.
    Gaff
    Edited by: Gaff on Feb 11, 2009 3:25 PM
    Actually, rowscn between 2 tables may not be an option. I know you can turn a rowscn into a time value so if that rowscn is derived from anything but the column values for the row that would foil that approach.

  • How to compare table data and table field

    Hi buddy,
        I have some question about how to compare table data and table field.
       1. I know there is one method:   CL_ABAP_UNIT_ASSERT=>ASSERT_TABLE_CONTAINS  , it use in unit test to compare the table data(A and B) , you can loop table A into structure A1, then use this mehtod it can compare whether table B contain structure A1.  but when I try to use this in main program it will dump.
              CL_ABAP_UNIT_ASSERT=>ASSERT_TABLE_CONTAINS(
                                                                                                        LINE    = A1
                                                                                                        TABLE = B ).
           Is there any method or FM can be used to compare the table data ?
        2. I also want to compare two table field , try to find out the different. How to realize this.
    Thank you for your sincerely answer.

    Hi Zongjie,
    What`s the difference, if you using loop A into wa_A, read table B into wa_B with all field, then compare with wa_A and wa_B.
    The question 2, seems no standard FM available here.
    Loop A into wa_A.
       Loop B into wa_B.
           if wa_A-field1 eq wa_B-field1.
           endif.
            if wa_A-field2 eq wa_B-field2. 
           endif.
       endloop.
    endloop.
    regards,
    Archer

  • Comparing two data records of same IDOC

    Hi,
    In PI, we need to compare two data records of same IDOC to figure out if what type change occurred.  For example, BENFIT3 IDOC contains data records tilted "E1BEN04".  When there are multiple "E1BEN04" data records, then we need to compare the data inside them to see whether name, or data of birth or SSN is changed. 
    Has anybody came across this before. Your help is much appreciated.
    Thanks
    -Teja

    If it is very few fields then you could use graphical mapping to determine the changes.

Maybe you are looking for

  • How to export playlist from PC to Iphone 5?

    I have created a playlist on Itunes of music from my PC and am trying to export them to my Iphone 5. How do I sync these? Thanks, Linda

  • Generic extraction- creation of data source

    hi gurus, I am creating a customized table which has both quantity and currency fields. i have given both the reference fields as well. Here the reference table used for quantity is ekko and the field is meins. and the reference table used for curren

  • Since DL Lion, My ichat will not load says i need to re-install

    I keep getting this error message, and i have checked for updates, and restarted my macbook pro several times, and still is not working..; "Check with the developer to make sure iChat works with this version of Mac OS X. You may need to reinstall the

  • EXTERNAL SPEAKERS DON'T WORK

    External speakers don't work. They are LABTEC LCS 2420 speakers. The internal speakers with RealTek driver works fine. I have an HP Pavilion 23 touchsmart All-In-One PC with windows 8. I plugged the speakers in the headphone port then tried the audio

  • When I get a date field value using the Oracle thin (type 4) JDBC driver...

    ....in 'DD-MMM-YY' format from an Oracle 8i database and pass it in to the java.util.Date() constructor, I get a IllegalArgumentException. This error doesn't occur when I use the type 2 driver, so it is apparently a driver-specific thing. It happens