• Post Reply Bookmark Topic Watch Topic
  • New Topic

Date conflict

 
Dave Foley
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on a page that creates a date time field and then inserts it into the database. To do this I've had to include some java files:
<%@ page import="java.util.*, java.text.*" %>
<%@ page import= "java.sql.*" %>
When I try to create a new Date with the following code I get an error saying there is a conflict with java.util.* and java.sql.* both having date functions. But the Date functions won't work with just the sql files.
Code:
String sOut = "";

Date today = new Date();
DateFormat df = DateFormat.getDateTimeInstance();
out.print("Date:" + df.format(today));
sOut=df.format(today);
session.setAttribute("snFinishTime", sOut);
response.sendRedirect("endSession2.jsp");
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this:
 
Dave Foley
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I probably should have thought of that!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!