Format a timestamp to string

suggest change

For 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);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents