Java tutorial
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** * get date as string from date-object * * @param Date date - date-object * @return String - string representation of the date (yyyy/MM/dd) */ public static String getDate(Date date) { DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); return ((dateFormat.format(date)).split(" "))[0]; } }