unix timestamp to datetime in android [duplicate]

You can use new java.util.Date(Long.parseLong(timeInMillis)). With this Date object there are several ways to extract the date in your desired String format, the simplest way using Date.toString(). Alternatively, and more appropriately you can use a SimpleDateFormat with the exact pattern you want.

Leave a Comment