Android examples for java.util:Date Format
get current time in yyyy/MM/dd/ HH:mm format
import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getData() { SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd/ HH:mm"); Date curDate = new Date(System.currentTimeMillis()); String str = formatter.format(curDate); return str;//from ww w .j av a 2 s . c o m } }