Android examples for java.util:Date Format
Format Date in long as MMM dd, yyyy format
import android.annotation.SuppressLint; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Random; public class Main{ @SuppressLint("SimpleDateFormat") public static String getDate(long timeStamp) { try {//ww w. j ava2 s . c o m SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy"); Date netDate = (new Date(timeStamp)); return sdf.format(netDate); } catch (Exception ex) { return ""; } } }