我得到了这个Twitter时间戳:
Sat Sep 20 19:11:19 ICT 2014
我想将其转换为:
20-09-2014 19:11
我怎样才能做到这一点?
在Java中使用SimpleDateFormat:
DateFormat outputFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm");
DateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss ZZZZZ yyyy", Locale.ENGLISH);
inputFormat.setLenient(true);
Date date = inputFormat.parse("Sat Sep 20 19:11:19 ICT 2014");
String outputText = outputFormat.format(date);
System.out.println(outputText);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句