public class Test { public static void main(String args[]) { Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH);// 注意:month特殊,是从0开始的, 也就是0表示1月 int day = c.get(Calendar. DAY_OF_ MONTH); System.out.println("现在是"+year+"年"+(month+1)+"月"+day+"日"); } }//源代码片段来自云代码http://yuncode.net