Convert from Long to date format

You can use below line of code to do this. Here timeInMilliSecond is long value.

 String dateString = new SimpleDateFormat("MM/dd/yyyy").format(new Date(TimeinMilliSeccond));

Or you can use below code too also.

 String longV = "1343805819061";
 long millisecond = Long.parseLong(longV);
 // or you already have long value of date, use this instead of milliseconds variable.
 String dateString = DateFormat.format("MM/dd/yyyy", new Date(millisecond)).toString();

Reference:- DateFormat and SimpleDateFormat

P.S. Change date format according to your need.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)