今年的格式爲2015-12-31T16:00:00.000Z,前端怎麼轉換都沒反應,只能在後臺接口裏轉啦,文章只是爲了備忘。
year = year.replace(“Z”,“UTC”);
SimpleDateFormat format = new SimpleDateFormat(“yyyy-MM-dd'T'HH:mm:ss.SSS Z”);
日期d = format.parse(年);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(“yyyy”); //
只要年份Date year_f = simpleDateFormat.format(d);