Link to home
Start Free TrialLog in
Avatar of dds110
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
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Element115
Element115

import java.util.*;
import java.util.Date;
import java.sql.*;

Or

import java.sql.Date;

if you you want to use the sql date