IntelliJ Java IDE
The moose likes JSP and the fly likes Date conflict Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Date conflict" Watch "Date conflict" New topic
Author

Date conflict

Dave Foley
Greenhorn

Joined: Feb 25, 2003
Posts: 9
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

Joined: Jun 26, 2001
Posts: 403
try this:
Dave Foley
Greenhorn

Joined: Feb 25, 2003
Posts: 9
Thanks, I probably should have thought of that!
 
 
subject: Date conflict
 
Threads others viewed
Junk characters while reading excel file
JDBC connectivity problem through JSP
clicking on text retrieve data from database
DateFormat class - not getting result
Junk characters while reading an excel file
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture