|
Joe -- To the end of your date format string add " zzzz". I'll bet the AS/400 is showing you CUT and not your local time. When you change QUTCOFFSET, you're changing what the machine things is CUT so your offset comes out okay. Here is what's happening, I think: Case 1 ------ System clock = 1/12/04 23:15 QUTCOFFSET = -6:00 Calculated CUT = 1/13/04 05:15 Java default timezone = CUT Java time returned = 1/13/04 05:15 Case 2 ------ System clock = 1/12/04 23:15 QUTCOFFSET = 0:00 Calculated CUT = 1/12/04 23:15 Java default timezone = CUT Java time returned = 1/12/04 23:15 Try running a small program from the command line with the -Duser.timezone=America/Chicago switch on and check out the results. It's difficult to recreate what you're trying to do from an incomplete explanation. Is the program you're trying to run being run with the RUNJVA command or the java command inside the shell or inside WAS? If inside WAS, you'll need to restart WAS in order to get the JVM to pick up the correct value of user.timezone. You might also add System.err.println("user.timezone = " + System.getProperty("user.timezone")); so we can see what timezone the JVM thinks it's in. Please let us know. Thanks, Gary > -----Original Message----- > From: java400-l-bounces@xxxxxxxxxxxx > [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Joe Pluta > Sent: Monday, January 12, 2004 9:31 PM > To: 'Java Programming on and around the iSeries / AS400' > Subject: RE: UTC and the JVM > > > > From: Gary L Peskin > > > > Java has all the settings built-in to adjust for daylight savings. > Use of > > CST for a timezone is not recommended, although it will work. > Instead, > > try: > > > > user.timezone=America/Chicago > > Okay, now I'm six hours ahead. > > I've got QUTCOFFSET of -06:00 > I've got user.timezone=America/Chicago > > I'm using the following line: > > new SimpleDateFormat("HH:mm:ss").format(new Date()); > > This returns times that are six hours ahead of my system > clock (that is, it's 23:15 on 01/12, and the JVM shows 05:15 > on 01/13). Setting QUTCOFFSET back to +00:00 returns the > time to normal, without restarting the JVM. > > Joe > > _______________________________________________ > This is the Java Programming on and around the iSeries / > AS400 (JAVA400-L) mailing list To post a message email: > JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change > list options, > visit: http://lists.midrange.com/mailman/listinfo/java400-l > or email: JAVA400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/java400-l. >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.