Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Mar 2002 16:25:41 +1300
From:      Jonathan Chen <jonc@chen.org.nz>
To:        Timothy Kettering <timster@blackcore.com>
Cc:        FreeBSD-Java <java@FreeBSD.ORG>
Subject:   Re: Setting the JVM timezone
Message-ID:  <20020313162541.A37054@grimoire.chen.org.nz>
In-Reply-To: <B8B3F8F7.582D%timster@blackcore.com>; from timster@blackcore.com on Tue, Mar 12, 2002 at 06:27:03PM -0600
References:  <20020312191638.A5376@fritz.cc.gt.atl.ga.us> <B8B3F8F7.582D%timster@blackcore.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 12, 2002 at 06:27:03PM -0600, Timothy Kettering wrote:

[...]
> But requesting the timezone in any java application I execute on the server
> gets me (+600 GMT).  And this makes absolutely no sense.  Where is this
> value coming from??  It's not CST, or even GMT.  The exact output of a
> simple program I included with this email (see below) is:
> 
> The TZ is: GMT+06:00
> 

Well, if I read this right, it says that you're 6 hrs *West* of GMT.
The UNIX convention has the '-' being East, '+' being West; New Zealand
has GMT-12. I'm not too sure whether Java has adopted this convention
though.

[...]
> Can people on this list run a simple program on their FreeBSD environment,
> and see if it returns the same TZ value that their server clock is set to,
> and let the list know?  Thanks.

I've tweaked it slightly, so that it looks like:

    import java.util.Date;
    import java.text.SimpleDateFormat;

    public class TestRun
    {
        public static void main(String[] args)
        {
            SimpleDateFormat formatter = new SimpleDateFormat("HH:mm zzz");
            String str = formatter.format(new Date());
            System.out.println("The time is: " + str);
        }
    }

Output is:

    central-~,4:20pm> date
    Wed Mar 13 16:20:23 NZDT 2002
    central-~,4:20pm> java TestRun
    The time is: 16:20 NZDT

That looks correct to me, I think.
-- 
Jonathan Chen <jonc@chen.org.nz>
----------------------------------------------------------------------
                        "Irrationality is the square root of all evil"
                                                  - Douglas Hofstadter

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020313162541.A37054>