Il toString() su Date() ti restituisce la data nel formato "dow mon dd hh:mm:ss zzz yyyy" (come puoi leggere nella documentazione).
Devi usare un SimpleDateFormat per ottenere la data nel formato che ti interessa.
http://docs.oracle.com/javase/7/docs...ateFormat.html
Ad esempio, se ti serve la data nel formato "anno/mese/giorno" puoi fare una cosa del genere:
codice:Date date = ... // esempio: 20 maggio 2015 SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); String dateAsString = sdf.format(date); System.out.println(dateAsString); // Stampa 2015/05/20

Rispondi quotando