How to convert timestamp to formatted date

Hey,
Converting timestamp is really simple to get the formatted date as you want. You just need to create a Calendar object and set your timestamp data on it.
Then you got the timestamp data into your calendar object and you can turn it as a string via “DateFormat.format” method.
Calendar cal = Calendar.getInstance(Locale.ENGLISH);cal.setTimeInMillis(timestamp);String date = DateFormat.format("dd-MM-yyyy hh:mm:ss", cal).toString();
Note: If your result always returns 1970, try this way :
Calendar cal = Calendar.getInstance(Locale.ENGLISH);
cal.setTimeInMillis(timestamp * 1000L);
String date = DateFormat.format("dd-MM-yyyy hh:mm:ss", cal).toString();
You need to multiple your TS value by 1000 :)
It’s so easy to use it.
If you have a question, ask me :)


How to extract filename from Uri?

Now, we can extract filename with and without extension :) You will convert your bitmap to uri and get the real path of your file. Now w...