Android - get date time from SMS timestamp in miliseconds
is it possible to convert Sms table date value e.g. 1293457709636 (miliseconds) to meaningful Date t开发者_运维百科ime value.
just do
long ms = 1293457709636; // or whatever you have read from sms
Date dateFromSms = new Date(ms);
You can convert Sms table date in to meaningful Date time like this.
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS");
Calendar calendar = Calendar.getInstance();
long now = 1293457709636L;
calendar.setTimeInMillis(now);
Log.i("time", "time"+formatter.format(calendar.getTime()));
精彩评论