Here you can find the source of toDateString(Date value)
public static String toDateString(Date value)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { public static String toDateString(Date value) { if (value != null) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return dateFormat.format(value); } else {/*from w ww . j a v a 2s .c om*/ return ""; } } }