In my app I am converting the date string which is in CST format (Thu jun 03 10:00 CST 2011) when I am converting into the date object it is converting it to the current time zone like Pacific Asia etc, but I want the same string which is given I don’t want any time zone changes.
Thanks,
balu.
Use the code given below. The use of locale is optional as it controls the language in which the date string appears. The important piece is the correct use of TimeZone. Try the code with different settings for Locale and TimeZone to see how the output changes. For example if you change Locale to:
Locale('fr','FR')the program will output:13 juillet 2011 08:05:31 PDTinstead ofJuly 13, 2011 8:05:52 AM PDT. Notice that the timezone is still PDT as we have not changed the TimeZone.