GregorianCalendar c= new GregorianCalendar(); int apm = c.get(GregorianCalendar.AM_PM); System.out.println(apm==0?"上午":"下午");