long timestamp = bornDate.getTime();Calendar cal = Calendar.getInstance();cal.setTimeInMillis(timestamp);return cal.get(Calendar.YEAR);
另外,您可以使用joda-time:
DateTime dateTime = new DateTime(bornDate.getDate());return datetime.getYear();
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)