Should we use the java.util.Date object in java? It has so many legacy methods that are a little unnecessary to use a sophisticated method for something that should be so simple.
I am using something stupid to emulate getDate () like:
public static int toDayMonth (Date dt)
{
DateFormat df = new SimpleDateFormat("dd");
String day = df.format(dt);
return Integer.parseInt(day);
}
This should be the best way ...
source
share