Duplicate :
|
|
Duplicate :
|
|
Relates :
|
BuddhistCalendar:set(year) can not set year before 543 correctly when set year below 543, the output from get is different from what is set. compile and run the attached code: import java.util.*; import java.text.*; public class SetTest{ public static void main(String[] args){ Calendar budcal = Calendar.getInstance(new Locale("th", "TH")); budcal.set(Calendar.YEAR, 200); System.out.println("Year:"+budcal.get(Calendar.YEAR)); budcal.set(Calendar.YEAR, 543); System.out.println("Year:"+budcal.get(Calendar.YEAR)); budcal.set(Calendar.YEAR, 544); System.out.println("Year:"+budcal.get(Calendar.YEAR)); budcal.set(Calendar.YEAR, 2000); System.out.println("Year:"+budcal.get(Calendar.YEAR)); budcal.set(300, Calendar.APRIL, 10); System.out.println("Year:"+budcal.get(Calendar.YEAR)); budcal.set(543, Calendar.APRIL, 10); System.out.println("Year:"+budcal.get(Calendar.YEAR)); budcal.set(544, Calendar.APRIL, 10); System.out.println("Year:"+budcal.get(Calendar.YEAR)); budcal.set(3001, Calendar.APRIL, 10); System.out.println("Year:"+budcal.get(Calendar.YEAR)); } } ===== the output is: Year:887(expecting 200) Year:544(expecting 543) Year:544(expecting 544) Year:2000 Year:787(expecting 200) Year:544(expecting 543) Year:544(expecting 544) Year:3001
|