Chandrasekhar M wrote: > > Getting an error on running this program. > > Any help would be appreciated. > > > > *public* *class* Test123 { > > > > *public* Test123() { > > // *TODO* Auto-generated constructor stub > > } > > > > /** > > * *...@param* args > > */ > > *public* *static* *void* main(String[] args) { > > // *TODO* Auto-generated method stub > > > > > org.joda.time.DateTimeZone./setDefault/(org.joda.time.DateTimeZone./forID/("Asia/Dubai")); > > System./out/.println(" > "+org.joda.time.DateTimeZone./getDefault/()); > > *int* year= 1920; > > *int* month= 1; > > *int* day= 1; > > *int* hour = 0; > > *int* min = 18 ; > > *int* sec = 40; > > *int* msec = 0; > > > > org.joda.time.DateTime dt = *new* > org.joda.time.DateTime(year,month,day,hour,min,sec,msec); > > System./out/.println(dt.getChronology().getZone()); > > System./out/.println(dt.toString()); > > } > > } > > > > Exception > > Asia/Dubai > > Exception in thread "main" _java.lang.IllegalArgumentException_: > Illegal instant due to time zone offset transition: > 1919-12-31T20:37:28.000 > > at > org.joda.time.chrono.ZonedChronology.localToUTC(_ZonedChronology.java:143_) > > at > org.joda.time.chrono.ZonedChronology.getDateTimeMillis(_ZonedChronology.java:119_) > > at > org.joda.time.chrono.AssembledChronology.getDateTimeMillis(_AssembledChronology.java:133_) > > at org.joda.time.base.BaseDateTime.<init>(_BaseDateTime.java:254_) > > at org.joda.time.base.BaseDateTime.<init>(_BaseDateTime.java:195_) > > at org.joda.time.DateTime.<init>(_DateTime.java:231_) > > at com.ehis.util.Test123.main(_Test123.java:25_) > > > > Regards > > Chandra Sekhar M. >
I can see why the NFS program 4 IT has been so successful. http://letmegooglethatforyou.com/?q=Illegal+instant+due+to+time+zone+offset+transition If that doesn't work for you... why not let the computer take the strain? public class Junk { public static void main(String[] args) { DateTime dt = new DateTime(1920, 1, 1, 1, 18, 40, 0,forID("Asia/Dubai")); System.out.println(dt); System.out.println(dt.minusHours(1)); } } Seems that you're trying to create a time that doesn't exist... As another suggestion, it will make your life easier to remove TODO's when they are done! (or just switch off "generate useless comments and javadoc" in Eclipse.) Best Regards, James ------------------------------------------------------------------------------ _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest