|
I have added user.timezone=Europe/London to the file SystemDefault.properties in /QIBM/UserData/Java400. I tried: Calendar z = new GregorianCalendar(TimeZone.getDefault()); System.out.println(z.getTime().toString()); // current date/time getting: Wed Aug 07 15:05:02 GMT+01:00 2002. So the time zone portion is now correct (BST = GMT+01:00) although the actual time is now 1 hour ahead. Request time was 14:05:02. It seems as if the JVM assumes the base time for the zone is without daylight saving (GMT in my case) and then the daylight adjustment is applied on top. However, since our AS/400 system time (QTIME) has already been adjusted for BST an extra hour has been added. There's no way I'll set QTIME to GMT due to the massive impact elsewhere! Instead I'll go for a workaround since the time zone part is now correct. The current date can be tested for daylight saving in effect by using the inDaylightTime method for the default TimeZone. Regards, Keith "Gary L Peskin" <garyp@firstech.com> on 06/08/2002 17:43:48 Please respond to java400-l@midrange.com To: java400-l@midrange.com cc: (bcc: Keith McCully/Wunderman/GB) Subject: RE: JavaMail API: SentDate problem As others have said, the JVM will always assume UTC unless you override the user.timezone JVM system property. The easiest way to do this is to create the file /QIBM/UserData/Java400/SystemDefault.properties, if not already there, and add the line: user.timezone=Europe/London If you're running inside WAS, you'll need to recycle WAS. On the last paragraph of your message, I'm not sure how you're getting this. If you're calling getDisplayName() it will show GMT+00:00 because that is the default representation. Try calling tz.getDisplayName(true, TimeZone.LONG) and you'll get more satisfactory results. Unlike UTC, Europe/London adjusts for Summer Time. Gary > -----Original Message----- > From: java400-l-admin@midrange.com > [mailto:java400-l-admin@midrange.com] On Behalf Of > Keith_McCully@wunderman.co.uk > Sent: Tuesday, August 06, 2002 8:42 AM > To: java400-l@midrange.com > Subject: RE: JavaMail API: SentDate problem > > > > > > Gary, > > You're right, the message was sent at 9:11:14 BST. It seems > that the actual time is correct but the time zone wrong. I'm > not sure but I think the JVM time is set from the system > variable QTIME which does not get automatically updated for > daylight saving. As far as I know, the time zone is not > updated or is that intentional as strictly BST is not a time > zone but a daylight saving feature of GMT? > > System.err.println(msg.getSentDate().toString()) gives Tue > Aug 06 16:27:32 GMT 2002 and again the time is right but > should be BST or GMT+01:00. > > Also, TimeZone tz = TimeZone.getTimeZone("Europe/London") and > TimeZone.getDefault() give time zone GMT+00:00. > > Regards, > > Keith > > > > > > "Gary L Peskin" <garyp@firstech.com> on 06/08/2002 15:58:21 > > Please respond to java400-l@midrange.com > > To: java400-l@midrange.com > cc: (bcc: Keith McCully/Wunderman/GB) > > Subject: RE: JavaMail API: SentDate problem > > > > Keith -- > > I'm not sure what you mean by "Posting Date". Your "Date:" > header shows the message was sent at 9:11:14 GMT which would > be 10:11:14 BST. Was that the correct time of sending or was > the message sent at 9:11:14 BST? I suspect that the message > was actually sent at 9:11:14 BST in which case the date > header is wrong. > > After you set the date in the message, try a > System.err.println(msg.getSentDate().toString()) > and see if that shows the correct time zone. > > I'm not sure what time zone is used for your AOL account but > it's possible that it could be wrong as well, compensating > for the possible error in your mail message. > > Could you send your message from the 400 directly to me at > <garyp@firstech.com>. That might help if you're still unable > to figure things out. > > Thanks, > Gary > > > -----Original Message----- > > From: java400-l-admin@midrange.com > > [mailto:java400-l-admin@midrange.com] On Behalf Of > > Keith_McCully@wunderman.co.uk > > Sent: Tuesday, August 06, 2002 2:16 AM > > To: java400-l@midrange.com > > Subject: RE: JavaMail API: SentDate problem > > > > > > > > > > > > Gary, > > > > Thanks for the reply. Here are the actual message headers > > ................ > > > > Field Name: $AdditionalHeaders > > Data Type: Text > > Data Length: 522 bytes > > Seq Num: 2 > > Dup Item ID: 0 > > Field Flags: > > > > "Received: from S44A2525.IMPIRIC.CO.UK ([152.146.128.22]) by > > wokgbpln01.wcj.co.uk (Lotus SMTP MTA v4.6.7 (934.1 > > 12-30-1999)) with SMTP id 80256C0D.002FFE33; Tue, 6 Aug > 2002 09:44:12 > > +0100 > > Message-ID: > > <-1237866248.1028625079793.JavaMail.MCCULLK@S44A2525.IMPIRIC.CO.UK> > > Date: Tue, 6 Aug 2002 09:11:14 +0000 (GMT) > > From: keith_mccully@wunderman.co.uk > > To: keith_mccully@wunderman.co.uk > > Subject: This is the Subject > > Mime-Version: 1.0 > > Content-Type: multipart/mixed; > > boundary="----=_Part_0_-1238131864.1028625076216" > > " > > > > I can confirm that the time of 09:11:14 shown above is actually > > correct but when I view it thru Lotus Notes Mail client the > time is 1 > > hour ahead @ 10:11:14 (which is the same time as shown on > the "Posted > > Date" field.) > > > > Also, I sent the same message to my AOL mailbox and there > the time was > > shown correctly. So it seems that JavaMail is working OK and the > > incorrect time is set on the receiving mail server from the > "Posting > > Date"? > > > > Regards, > > > > Keith > > _______________________________________________ > This is the Java Programming on and around the iSeries / > AS400 (JAVA400-L) mailing list To post a message email: > JAVA400-L@midrange.com To subscribe, unsubscribe, or change > list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l > or email: JAVA400-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/java400-l. > > > > > > > > _______________________________________________ > This is the Java Programming on and around the iSeries / > AS400 (JAVA400-L) mailing list To post a message email: > JAVA400-L@midrange.com To subscribe, unsubscribe, or change > list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l > or email: JAVA400-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/java400-l. > _______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l or email: JAVA400-L-request@midrange.com 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.