我使用了这段代码:
String[] columnDate = new String[] {"date"};
Cursor cursor1 = getContentResolver().query(Uri.parse("content://sms/inbox"),
columnDate ,null, null, "date desc limit 1");
cursor1.moveToPosition(0);
String msgData1Date = cursor1.getString(0);
..它有效,但给出了这种格式的日期“1352933381889”
如何将String类型转换为正常的日期/时间格式?
尝试这个:
Date date = new Date(cursor1.getLong(0));
String formattedDate = new SimpleDateFormat("MM/dd/yyyy").format(date);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)