private int getAge(Date birthDate) {
int birthYear = Integer.parseInt(DateTimeFormat.getFormat("yyyy").format(birthDate));
int birthMonth = Integer.parseInt(DateTimeFormat.getFormat("MM").format(birthDate));
int birthDayOfMonth = Integer.parseInt(DateTimeFormat.getFormat("dd").format(birthDate));
Date today = new Date();
int todayYear = Integer.parseInt(DateTimeFormat.getFormat("yyyy").format(today));
int todayMonth = Integer.parseInt(DateTimeFormat.getFormat("MM").format(today));
int todayDayOfMonth = Integer.parseInt(DateTimeFormat.getFormat("dd").format(today));
boolean hasHadBirthdayThisYear;
if (todayMonth < birthMonth) {
hasHadBirthdayThisYear = false;
} else if (todayMonth > birthMonth) {
hasHadBirthdayThisYear = true;
} else {
hasHadBirthdayThisYear = birthDayOfMonth <= todayDayOfMonth;
}
int age = todayYear - birthYear;
if (!hasHadBirthdayThisYear) {
age--;
}
return age;
}
我想对我的css文件进行一些小的更改,但网站没有回复它们。我可以在标题中添加任何类型的缓存HTML代码吗?