Android examples for java.util:Date Format
get current time in yyyy-MM-dd format
import java.text.SimpleDateFormat; import java.util.Date; public class Main{ public static String getData_yyyy_MM_dd() { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); Date curDate = new Date(System.currentTimeMillis()); String str = formatter.format(curDate); return str; }/*from w ww .java2 s . com*/ }