0
我需要以下時間戳轉換解析時間戳成可讀的格式(安卓)
String s = "08-12-2014 05:00:00"
to a readable format like "Today 5am"
敬請建議我怎麼能做到這一點,或者我可以使用libaries。
BTW這裏是我的嘗試
String ago = hourly.getHour(j).time() ;
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH);
Date d = inputFormat.parse(ago);
SimpleDateFormat outputFormat= new SimpleDateFormat("EEEE, MMMM dd, yyyy HH:mm a");
我猜你正在尋找這個.. http://developer.android.com/reference/android/text/format/DateUtils.html#getRelativeDateTimeString %28android.content.Context,%20long,%20long,%20long,%20int 29% – Panther 2014-12-08 06:08:21