0. I setup my Android emulator time zone to: Australia/Adelaide GMT
+10:30
1. My code snippet:
mtz = new SimpleTimeZone(8 * 60 * 60 * 1000, "Asia/Shanghai");
GregorianCalendar gc1 = new GregorianCalendar(); //using default,
that is Adelaide
GregorianCalendar gc2 = new GregorianCalendar(mtz); //using my
customized time zone
Date d1 = gc1.getTime();
Log.v(TAG, "testCalendar2: d1.toString: "+d1.toString());
Log.v(TAG, "testCalendar2: d1.toGMTString: "+d1.toGMTString());
Date d2 = gc2.getTime();
Log.v(TAG, "testCalendar2: d2.toString: "+d2.toString());
Log.v(TAG, "testCalendar2: d2.toGMTString: "+d2.toGMTString());
2. My Log.v
20:11:04.807: VERBOSE/worldclock(669): testCalendar2: d1.toString: Fri
Mar 06 20:10:55 GMT+10:30 2009
20:11:04.927: VERBOSE/worldclock(669): testCalendar2: d1.toGMTString:
6 Mar 2009 09:40:55 GMT
20:11:13.967: VERBOSE/worldclock(669): testCalendar2: d2.toString: Fri
Mar 06 20:10:55 GMT+10:30 2009
20:11:14.277: VERBOSE/worldclock(669): testCalendar2: d2.toGMTString:
6 Mar 2009 09:40:55 GMT
3. I supposed to think d2 should be the Asia/Shanghai datetime, but
GregorianCalendar.getTime always returns the default time zone based
datetime. So:
Do I using the GregorianCalendar in the right way?
Why will GregorianCalendar provides a timezone based constructor?
BRs
He
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---