dds110
asked on
Java Dates
Here is my function:
import java.sql.*;
import java.util.*;
import java.text.*;
public class test
{
public static void main(String[] args)
{
String s;
Format fm;
Date date = new Date();
fm = new SimpleDateFormat("EEEE, MMMM dd, yyyy");
s = fm.format(date);
System.out.println(s);
}
}
The error I get is on the line: Date date = new Date();
The error description is: reference to date is ambiguous, both class java.util.Date in java.util and class java.sql.Date in java.sql match
I need the util import for later. Now what do I do(I've already created a different class as a workaround. What do I do so I don't have to create the different class?)?
Thanks
DDS
import java.sql.*;
import java.util.*;
import java.text.*;
public class test
{
public static void main(String[] args)
{
String s;
Format fm;
Date date = new Date();
fm = new SimpleDateFormat("EEEE, MMMM dd, yyyy");
s = fm.format(date);
System.out.println(s);
}
}
The error I get is on the line: Date date = new Date();
The error description is: reference to date is ambiguous, both class java.util.Date in java.util and class java.sql.Date in java.sql match
I need the util import for later. Now what do I do(I've already created a different class as a workaround. What do I do so I don't have to create the different class?)?
Thanks
DDS
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
import java.util.Date;
import java.sql.*;
Or
import java.sql.Date;
if you you want to use the sql date