Format a timestamp to string
suggest changeFor full description of patterns, see SimpleDateFormat reference
Date now = new Date();
long timestamp = now.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.US);
String dateStr = sdf.format(timestamp);
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents