我有这样的代码:如何将毫秒内的字符串转换为日期?
String id = c.getString("data");
String name = ((TextView) view.findViewById(R.id.TextView05)).getText().toString();
public static String getDate(long seconds, String dateFormat)
{
DateFormat formatter = new SimpleDateFormat("yyyy MMMM dd HH:mm");
long now = System.currentTimeMillis();
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(now);
return formatter.format(calendar.getTime());
}
的"data"
是1341435600000
。我想从毫秒到这个字符串。
“数据”:1341435600000 – user1563977 2012-07-31 10:37:01
有任何错误? – jeet 2012-07-31 10:39:54
nope,刚刚得到134143560000000 – user1563977 2012-07-31 10:41:33