我無法打印的GregorianCalendar公曆Java錯誤
package Tests;
import java.util.Date;
import java.util.GregorianCalendar;
public class Data
{
public static void main(String[] args)
{
GregorianCalendar time = new GregorianCalendar(1999, 2, 2);
System.out.println(time);
}
}
我收到此
java.util.GregorianCalendar中的[時間= ?, areFieldsSet =假,areAllFieldsSet =假,寬鬆=真,區= sun.util.calendar.ZoneInfo [ID = 「歐洲/貝爾格萊德」,偏移= 3600000,dstSavings = 3600000,useDaylight =真,過渡= 119,lastRule = java.util.SimpleTimeZone中[ID =歐洲/貝爾格萊德,偏移= 3600000,dstSavings = 3600000,useDaylight =真,startYear = 0,STARTMODE = 2,startMonth = 2,朝九特派= -1,startDayOfWeek = 1,開始時間= 3600000,startTimeMode = 2,endMode = 2,endMonth = 9,endday指定= -1,endD ayOfWeek = 1,結束時間= 3600000,endTimeMode = 2]],Firstdayofweek可= 2,minimalDaysInFirstWeek = 4,ERA = ?, YEAR = 1999,MONTH = 2,WEEK_OF_YEAR = ?, WEEK_OF_MONTH = ?, DAY_OF_MONTH = 2,DAY_OF_YEAR = ?, DAY_OF_WEEK = ?, DAY_OF_WEEK_IN_MONTH = ?, AM_PM = 0,小時= 0,HOUR_OF_DAY = 0,分= 0,SECOND = 0,多段微差= ?, ZONE_OFFSET = ?, DST_OFFSET =?]
如何打印它?
檢查的SimpleDateFormat(見HTTPS ://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html) – Leo