Here you can find the source of dateToString(Date date)
public static String dateToString(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Formatter; public class Main { private static final SimpleDateFormat dateformat = new SimpleDateFormat( "yyyy-MM-dd"); public static String dateToString(Date date) { return dateformat.format(date); }/* w ww . ja va 2 s.c o m*/ public static String format(String format, Object... args) { return format(null, format, args); } public static String format(StringBuilder builder, String format, Object... args) { if (builder == null) { builder = new StringBuilder(); } new Formatter(builder).format(format, args); return builder.toString(); } }