判断当前时间是上午仍是下午

判断当前时间是上午还是下午
/**
* 判断当前时间是上午还是下午
* @return
*/
public static String newDateIsAMOrPM(){
String info = null;
String time = ToStringTime(4, new Date());
String hour = time.substring(0, 2);
String minutes = time.substring(3, 5);
int difference = 0;
if(hour.substring(0, 1).equals("0")){
difference = Integer.parseInt(hour.substring(1, 2)) * 60;
}else{
difference = Integer.parseInt(hour) * 60;
}
if(minutes.substring(0, 1).equals("0")){
difference = difference + Integer.parseInt(minutes.substring(1, 2));
}else{
difference = difference + Integer.parseInt(minutes);
}
if(difference >= 18 * 60){
info = "PM";
}else{
info = "AM";
}
return info;
}