Avatar of mhaave
mhaave
Flag for Norway asked on

Java time on iSeries?

Hello

I have a problem getting Java programs on iSeries to return the right time. The time is always wrong with an hour or two.
The following system values are set:
QTIME set to current true time.
QTIMZON set to QP0100UTCS.
Added line in SystemDefault.properties: user.timezone=Europe/Oslo

I have created a simple test program (code attached) which I run, and it prints the following:
Display name:  Central European Time
Display name DST: Central European Summer Time
DST offset:  3600000
ID: Europe/Oslo
Offset today: 7200000
Raw offset: 3600000
Current date: Mon Oct 12 13:58:19 CEST 2009
Locale: norsk (Norge)    (Norway)

Current Date is wrong by one hour. Java reports one hour later than real time. We are in Norway, and the offset should be 1 hour, and it is summertime. When running the same program on a PC, regardless of TimeZone, it always works. What am I missing?? All our RPG and CL programs work fine with dates and times.
Btw: We are using Java version 1.5.0, Classic VM build 1.5.0_13-b05)
public class TimeCheck
{
	public static void main(String[] args)
	{
		final TimeZone zone = TimeZone.getDefault();
		System.out.println("Display name:           " + zone.getDisplayName());
		System.out.println("Display name DST=false: " + zone.getDisplayName(false, TimeZone.LONG));
		System.out.println("Display name DST=true:  " + zone.getDisplayName(true, TimeZone.LONG));
		System.out.println("DST offset:             " + zone.getDSTSavings());
		System.out.println("ID:                     " + zone.getID());
		System.out.println("Offset today:           " + zone.getOffset(System.currentTimeMillis()));
		System.out.println("Raw offset:             " + zone.getRawOffset());
		System.out.println("Current time in millis: " + System.currentTimeMillis());
		System.out.println("Dato:                   " + new Date().toString());
		System.out.println("Locale:                 " + Locale.getDefault().getDisplayName());
		
	}
}

Open in new window

IBM System iJava

Avatar of undefined
Last Comment
mhaave

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Gary Patterson, CISSP

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
mhaave

ASKER
It was QP0100CET2 :-)
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck