This is the viewer question asked by smiten.
how can i compare the database stored time to current time?
I had previously written an article about how to display time in jspNow just make some changes retrieve the database time and split the values of hours,minutes,seconds and finally check the values to get the real time.


<%@ page language="java" import="java.util.*,java.sql.*,java.math.*,java.text.SimpleDateFormat"pageEncoding="ISO-8859-1"%>
Calendar calendar = Calendar.getInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
String date=dateFormat.format(calendar.getTime());
String c="select * from time";
	st1=con.createStatement();
	ResultSet rs1=st1.executeQuery(c);
	while(rs1.next())
	{
dbdate=rs1.getString(5);
}
 String[] exdate=a.split("-");
	 int dbdate=Integer.parseInt(dbexdate[0]);
	 String[] currentdate=date.split("-");
	 int cdate=Integer.parseInt(currentdate[0]);

 if(dbenddate[1].equals(currentdate[1]))
			 {
	 diff=dbdate-cdate;
			 }
out.println(diff);
%>



Have a doubt leave a comment,Happy coding

Related Posts

  1. Finding created/modified time of files in a folder
  2. Display current time and date in your Jsp page
  3. Print current time using java in jsp page
  4. Finding/removing duplicate values from database using sql
  5. Hsqldb another database how to use it.