Compare current date with dat from db by JSTL

hi all
I use
<tr><c:forEach items="${allFound}" var="found" varStatus="myRow">
<td><c:out value="${found.submitDate}"/></td>
</tr>
</c:forEach>
to past some value out of db
how can I compare this submitDate with Current Date by JSTL
Thank you!

Whether or not you can compare it depends on what the type of "${found.submitDate} is coming from the Database.
I am going to presume it is a java.util.Date.
You can get the current date like this
<jsp:useBean id="now" class="java.util.Date"/>
You can then compare them using an EL expression:
{code}
<c:if test="${submitDate < now}">
We have not yet reached the submit date.
</c:if>{code}
EL uses the java compareTo methods, so both of your objects +must+ be of the same class in order for this comparision to work.
If you get back a String from the database, you would have to use <fmt:parseDate> to get a java date.
If you get back a java.sql.Date from the database, it would get trickier. The hack would be to go java.sql.Date -> String -> java.util.Date using <fmt:formatDate> and <fmt:parseDate>
Hope this helps,
evnafets

Similar Messages

  • 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

  • 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 Get Current Date from MS Access in a Select Statement

    From a java method, I want to use JDBC to get the current date from MS Access. In Oracle I would do "select sysdate from dual", but I can't figure out how to do it in MS Access. Here are some of my attempts. I have a table in my Access db called PARM.
    //        String sql = "SELECT '0', NOW() FROM PARM";
    //rs.next() is false
    //        String sql = "SELECT NOW() AS CURR_DT FROM PARM";
    //rs.next() is false
    //        String sql = "SELECT DATE() AS CURR_DT FROM PARM";
    //rs.next() is false
    //        String sql = "SELECT NOW()"; 
    //StringIndexOutOfBoundsException: String index out of range: -1
    //        String sql = "select { fn now() } from parm";
            String sql = "SELECT Date()";
    //java.lang.StringIndexOutOfBoundsException: String index out of range: -1
            ResultSet rs = stmt.executeQuery(sql);
            if (rs.next()) {
                return rs.getString(1);
            } else {
                   return null;
              }

    Why are you getting it as a String? You should be getting it as a timestamp.
    Although getString works for me too. There is something else wrong that you haven't shown.
    Here is some shoddy, but simple, test code that demonstrates it working.
    import java.sql.*;
    public class Test{
      public static void main(String args[])throws Exception{
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection c = DriverManager.getConnection("jdbc:odbc:stats");
        Statement s = c.createStatement();
        ResultSet rs = s.executeQuery("SELECT NOW()");
        while(rs.next()){
          System.out.println(rs.getTimestamp(1));     
        rs.close();
        s.close();
        c.close();
    }

  • Variant must get the current date from the system.

    Hi All,
    I really appreciate your help on below please;
    I need to create a variant and schedule a report program once a day.
    But variant must get the current date from the system (sy-datum).
    The program should run for the values in the variant in schedule job run;
    Can I do this using SAP variants (for Report Program) and schedule the job.
    Many thanks
    Iver

    Standard functionality.
    http://help.sap.com/saphelp_nw70/helpdata/en/c0/98039be58611d194cc00a0c94260a5/frameset.htm
    Thomas

  • How to get the current Date from the system?

    How do I acquire the current date from the system? Also, if possible, can I assign the day, month and year separately into three variables and how? It would be thankful if some simple Example could be given. Thanx!

    import java.util.*;
    public class count {
    public count() {
    Calendar now = Calendar.getInstance();
    int month = now.get(Calendar.MONTH);
    int day = now.get(Calendar.DAY_OF_MONTH);
    int dayyear = now.get(Calendar.DAY_OF_YEAR);
    int year = now.get(Calendar.YEAR);
    int a = 365;
    int b = a - dayyear;
    System.out.println("The day is the" + " " + day);
    System.out.println("IT is the" + " " + month + " " + "month of the year");
    System.out.println("The year is" + " " + year);
    System.out.println("This many days till next year" + " " + b);
    public static void main(String[] args) {
    count cou = new count();
    }

  • Compare - Current Data with Perious Data.

    Experts,
    We have created default report like below
    Date - Company - Product - SCode - Amt Spent - Net Amt - Calls
    12/12/2010 C1 P1 Code1 1000 1500 15
    13/12/2010 C2 P4 Code2 1500 1200 10
    12/12/2009 C1 P3 Code3 2000 1700 25
    11/12/2010 C3 P1 Code4 3000 1600 10
    11/11/2009 C2 P2 Code5 5000 3000 30
    Grand Total 12000 9000 90
    Here we are using Column selector for Date column to change the report from Date to Week (or) Month (or) Quarter (or) Year.
    My Questions
    1. I want to compare Default Date report with Perious Date, Last month Date and Last Year Date.
    2. If I select Month from Column Selector then I want to compare Month report with Last Month, Last year Month or Perious of Last year month.
    3. If I select Year from Column Selector then I want to compare Year report with Last year, or Perious of Last year and so on.
    Please help me, how can we achive the above task.
    Thanks in Advance.
    Balaa...

    Hello,
    First you have to define the new measures for last month, last year and so on. You can refer to this link:
    http://www.rittmanmead.com/2007/04/obi-ee-time-dimensions-and-time-series-calculations/
    After that, what you can do is instead of using a "Column Selector" you should use "View Selector". You can create different views, one for month, other for Year and include them into a "View Selector".
    After that you can add it in "Compound Layout".
    Regards,
    JorgeRS.

  • 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

  • Can a field be made to pull the current date from computer or internet and display it?

    Im making a form for someone and they want the current date of when the form is opened to be displayed at the top without having to type it in.  Is this possible?  I assume this has something to do with javascript but I dont know anything about that stuff

    Hi,
    I search something in the forum and found your message. If you need it once again, try this:
    var f = this.getField("currentDate");
    f.value = util.printd("dd.mm.yyyy",new Date());
    Or this one (helpful for Germans who want to display their date like this: 29. Juni 2010. If you take the first one in the dd. mmmm yyyy format, it shows you the month in English. 29. June 2010):
    var f = this.getField("currentDate");
    f.value = util.printd("date(de){DD. MMMM YYYY}", new Date(), true);

  • How to compare current time with any particular time?

    Hi All,
    Problem:
    I have a form which accept data from user but i want that user can enter data only before 4 in the evening after that no data will be accepted and user get any message. Now the problem is I want to compare the current time with 4 o clock or 16:00:00 but i dont know how to check whether the current time is greater or lesser than 4. Till now my code are like this: if(tt.equals("16:00:00")){}else{}
    where tt is current time. but this is not the feasible solution for my second clause.
    Any kind of help will greatly appreciate.
    Thanks

    One more thing:
    I find timestamp class quite helpful in my case but i
    dont know how to implement the before() method
    of this class.
    Any idea.* You wouldn't implement before(). You'd just use it. It's already implemented for you.
    * before() doesn't just compare the hour of the day. It compare two date & time objects to see which one is greater--that is, it effectively looks at all the fields, not just HOUR.
    * You don't need Timestamp if you're not dealing with a database.

  • Compare current value with previous value

    Hello,
    I would like to compare the current value with the previous value of the current value.
    How can I solve this problem?
    Maurits

    Hi,
    after going through the basics course you surely can understand that example:
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Can anyone tell me how to import current data from apps when I upgrade to a new phone?

    Hi,
    When activating my new iPhone 5S, after syncing my old 3GS to iTunes then immediately syncing the new phone, the data in some of my apps that was imported was very, very old. Examples are entries in Calengoo, entries in Due, and entries in Balance. In all of those apps, the information that was imported onto my new phone was from last fall, late September or early October. I resolved the issue with Calengoo and with Due, but not yet with Balance. Also, the podcasts that were imported onto my new phone were not the ones that are currently downloaded onto my old phone. I must be doing something wrong on the sync of the old phone (? or so I guess)?
    If anyone can help me get it straight, I'd be most grateful.
    Thanks,
    Chris

    Thanks Jim. If I create a backup, can I use that to only import certain apps, or will that backup replace what's currently on my new phone? If that does happen, I figure I can sync the new phone to iTunes, use the backup created from the old phone to bring that info to the new phone, then use the sync I just made to bring back the information / apps I've since added to my new phone?
    Thanks!
    Chris

  • How to get the date starting from 1 to the current date from the system dat

    Dear all,
    Please tell me how to get the date starting from 1 based on the system date
    and it should come with respect of time also.
    example.
    suppose today is 6 Dec, 2006
    so ABAP report should find the 1 dec. 2006.
    Please help me as soon as possible.
    Regards,

    concatenate sy-datum0(2) '01' sy-datum4(4) into v_firstdate.
    or yo ucan use the fm:
    HR_JP_MONTH_BEGIN_END_DATE
    usage:
        call function 'HR_JP_MONTH_BEGIN_END_DATE'
             exporting
                  iv_date             = sy-datum
             importing
                  ev_month_begin_date = gv_begda
                  ev_month_end_date   = gv_endda.
    Regards,
    Ravi
    Message was edited by:
            Ravi Kanth Talagana

  • SSRS Variance expression problem. Create a Variance expression. Compare current month with same month from previous year.

    Hello,
    I am using VS2010 shell.  I have a matrix report where I have a row group by Year.  Then I have a column group by Month. 
    When I run the report, I get 2013 data on top of 2014 data.  Now I need to create a variance by year for each month.
    So in the example below, I need to create an expression that will pull the variance for Oct 01... subtracting 2013 from 2014 for the months.  So I need to Subtract 8,222 - 4290.  I have no clue.
    Here is what my rdl looks like.
    Thank you for your help. 

    Hi Adrian,
    If I understand correctly, you want to calculate the difference order between 2013 and 2014 for every month. And there are only two years in the FISCAL_YEAR field.
    If in this scenario, we can simply use the following expression to achieve your requirement:
    =first(Fields!ORDER.Value)-last(Fields!ORDER.Value)
    The following screenshot is for your reference:
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Not able to get the current data from the screen

    Hello All,
    I have created a table view on a value node.  I edit a field which has a date F4 help or a field DDLB and click SAVE.
    In the save event handler I am using get first statement in the loop and when I see the contents of the entity it is the old data not the new values.
    Could you please help me on this ?
    Regards
    Sohit

    Hi Sohit,
    Use GET_CURRENT method of CL_CRM_BOL_ENTITY and try.....
    (make sure the Setter method is updating the values)
    Regards,
    Masood Imrani S.

Maybe you are looking for