| | |
date comparison
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2007
Posts: 30
Reputation:
Solved Threads: 0
Hi,
I have a html table , in table i am displaying dates in column called date, now i want to compare dates in the date column with current system date.
if any one have existing code(in jsp ,javascript) for this please forward me or any advise and suggestions are appriciated.
query 2:
i have two date columns (called startdate, enddate)in my database ,in that i am displaying one column (enddate)in front end in table format .
now the problem is i have to compare these two fields i.e startdate which is in backend and enddate in which i display in fornt end. and perform some calculation. please tell how to compare these two.
using jsp or javscrip t or any other suggestions are appreciated
Regards
Akash
I have a html table , in table i am displaying dates in column called date, now i want to compare dates in the date column with current system date.
if any one have existing code(in jsp ,javascript) for this please forward me or any advise and suggestions are appriciated.
query 2:
i have two date columns (called startdate, enddate)in my database ,in that i am displaying one column (enddate)in front end in table format .
now the problem is i have to compare these two fields i.e startdate which is in backend and enddate in which i display in fornt end. and perform some calculation. please tell how to compare these two.
using jsp or javscrip t or any other suggestions are appreciated
Regards
Akash
> i want to compare dates in the date column with current system date.
Check the 'before()', 'after()' and 'equals()' methods of the Date or the Calendar class.
> now the problem is i have to compare these two fields
Without knowing the scenario, it would be difficult to suggest anything. Since one of the values is in the database, do the comparison in the servlet itself.
Check the 'before()', 'after()' and 'equals()' methods of the Date or the Calendar class.
> now the problem is i have to compare these two fields
Without knowing the scenario, it would be difficult to suggest anything. Since one of the values is in the database, do the comparison in the servlet itself.
I don't accept change; I don't deserve to live.
There are a lot many ways of comparing dates depending on the source of dates and which class you are using to represent them (Date, java.sql.Date, Calendar), which would accordingly require some conversion.
Here is a simple example of comparing two java.util.Date objects.
Here is a simple example of comparing two java.util.Date objects.
java Syntax (Toggle Plain Text)
public static void main(String[] args) throws ParseException { Date today = new Date(); Date before = new SimpleDateFormat("dd/MM/yyyy").parse("26/07/2007"); if(today.after(before)) { System.out.println("[" + today + "] lies after [" + before + "]"); } else { System.out.println("[" + today + "] lies before or is the same as [" + before + "]"); } }
I don't accept change; I don't deserve to live.
![]() |
Similar Threads
- trying to do a date of birth comparison. (Java)
- Desktop and Finder partially paralyzed--HD Full or Virus or ?--on G4 15" Powerbook (OS X)
- VBA Date Format (Visual Basic 4 / 5 / 6)
- How to erase Date Last Accessed Info (Windows NT / 2000 / XP)
Other Threads in the JSP Forum
- Previous Thread: problem encountered while running a jsp on tomcat 5.5
- Next Thread: Table calculation
| Thread Tools | Search this Thread |
apache array backbutton combobox comma connection csv database development directorystructure dropdownlist dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 mysql netbeans network parameters passing ping printinserverinsteadofclient read redirect request.getparameter response seperated servlet servletdopost()readxml sessions software sql ssl state_saving_method stocks sun tomcat tutorial update values video web write






