There is not 100% compatibility - some IDs like CST do not work. You must manually convert between the invalid short IDs and the valid long ones.
Stephen On 27 December 2011 06:20, Pradeep Reddy Jutur <jprad...@prokarmasoftech.com> wrote: > I do know that CST is not a valid timezone id , but java.util.Timezone class > considers it as a valid value . > How do you provide compatibility between joda and util timezones ? > > > On Mon, Dec 26, 2011 at 4:38 PM, Stephen Colebourne <scolebou...@joda.org> > wrote: >> >> The valid time zone IDs are listed here - >> http://joda-time.sourceforge.net/timezones.html . CST is not one of >> them. >> Stephen >> >> On 26 December 2011 15:14, Pradeep Reddy Jutur >> <jprad...@prokarmasoftech.com> wrote: >> > Here is my code to convert UTC time to CST/PST. >> > >> > >> > String testDate = "2011-12-21T18:47:00Z"; >> > DateTime utcDateTime = new DateTime(testDate,DateTimeZone.UTC); >> > System.out.println("Time in UTC : "+utcDateTime.toString("MM/dd >> > HH:mm")); >> > DateTimeZone zone = DateTimeZone.forID("CST"); >> > DateTime cstTime = utcDateTime.toDateTime(zone); >> > >> > >> > But the code throws following exception >> > >> > Exception in thread "main" java.lang.IllegalArgumentException: The >> > datetime >> > zone id 'CST' is not recognised >> > at org.joda.time.DateTimeZone.forID(DateTimeZone.java:215) >> > at >> > >> > org.mine.joda.test.TimeZoneConversionTest.main(TimeZoneConversionTest.java:15) >> > >> > >> > >> > Can someone please tell me how to convert the time to CST from UTC >> > >> > >> > >> > -- >> > Best Regards, >> > Pradeep. >> > Voip - 402-522-8648 >> > >> > >> > Confidentiality Notice & Disclaimer: >> > This message and any attachments are solely intended for the >> > addressee(s). >> > It may also be Prokarma Softech Pvt Ltd confidential, privileged and / >> > or >> > subject to copyright. Access to this email by anyone else is >> > unauthorized. >> > If you are not the intended recipient, any disclosure, copying, >> > distribution >> > or any action taken or omitted to be taken in reliance on it, is >> > prohibited >> > that may be unlawful. If you have received this in error, please notify >> > the >> > sender immediately by return e-mail and delete it from your computer. >> > While >> > all care has been taken, Prokarma Softech Pvt Ltd management disclaims >> > all >> > liabilities for loss or damages to person(s) or properties arising from >> > misuse of any information provided or the message being infected by >> > computer >> > virus or other contamination >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > Write once. Port to many. >> > Get the SDK and tools to simplify cross-platform app development. Create >> > new or port existing apps to sell to consumers worldwide. Explore the >> > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join >> > http://p.sf.net/sfu/intel-appdev >> > _______________________________________________ >> > Joda-interest mailing list >> > Joda-interest@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/joda-interest >> > >> >> >> ------------------------------------------------------------------------------ >> Write once. Port to many. >> Get the SDK and tools to simplify cross-platform app development. Create >> new or port existing apps to sell to consumers worldwide. Explore the >> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join >> http://p.sf.net/sfu/intel-appdev >> _______________________________________________ >> Joda-interest mailing list >> Joda-interest@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/joda-interest > > > > > -- > Best Regards, > Pradeep. > Voip - 402-522-8648 > > > Confidentiality Notice & Disclaimer: > This message and any attachments are solely intended for the addressee(s). > It may also be Prokarma Softech Pvt Ltd confidential, privileged and / or > subject to copyright. Access to this email by anyone else is unauthorized. > If you are not the intended recipient, any disclosure, copying, distribution > or any action taken or omitted to be taken in reliance on it, is prohibited > that may be unlawful. If you have received this in error, please notify the > sender immediately by return e-mail and delete it from your computer. While > all care has been taken, Prokarma Softech Pvt Ltd management disclaims all > liabilities for loss or damages to person(s) or properties arising from > misuse of any information provided or the message being infected by computer > virus or other contamination > > > ------------------------------------------------------------------------------ > Write once. Port to many. > Get the SDK and tools to simplify cross-platform app development. Create > new or port existing apps to sell to consumers worldwide. Explore the > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join > http://p.sf.net/sfu/intel-appdev > _______________________________________________ > Joda-interest mailing list > Joda-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/joda-interest > ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest