我有這樣的代碼:如何將毫秒內的字符串轉換爲日期?
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