Convert Timestamp into Date and Time

Public String getDatafTimeStamp(long timestamp){
java.util.Date time=new java.util.Date(timestamp*1000);
          SimpleDateFormat pre = new SimpleDateFormat("EEE MM dd HH:mm:ss zzz yyyy");
                           //Hear Define your returning date formate
          return pre.format(time);
}

2 comments:

Unknown said...

It is perfect and simple, if you come here for the firebase servervalue timestamp feature just don't multiple by 1000

Unknown said...

Add date and timestamp in an easy way. It’s totally worth to download
App name: Auto Numbering Stamp: Add Sequence Stamp To Photos
Link:
https://play.google.com/store/apps/details?id=com.autonumberstamp.autoaddsequencestamptocameragalleryphotos