You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by John Summerfield <su...@OS2.ami.com.au> on 2000/03/09 22:46:53 UTC

Re: tomcat 3.1 beta; bad locale information.

> Works for me on RedHat 6.0 sun's jdk 1.2.2 (I am GMT +11). What jdk are
> you using? 

Sorry. I should know better.

[summer@possum summer]$ java   -fullversion
java full version "JDK 1.1.8 IBM build l118-19991013 (JIT enabled: jitc)"
[summer@possum summer]$

> 
> Note that date format is hard coded in the getDate() method in
> JspCalendar.java:
> 
>     public String getDate() {
>         return getMonthInt() + "/" + getDayOfMonth() + "/" +  getYear();
>     }
> 
> This is why the format is not localised. It should probably be done as
> follows:
> 
>     public String getDate() {
>         Calendar myCal = Calendar.getInstance();
>         DateFormat df = DateFormat.getDateInstance();
>         return df.format(myCal.getTime());
>     }
> 
> this produces:
> 
> Day of month: is 10 
>      Year: is 2000 
>      Month: is March 
>      Time: is 7:39:25 
>      Date: is Mar 10, 2000 
>      Day: is Friday 
>      Day Of Year: is 70 
>      Week Of Year: is 11 
>      era: is 1 
>      DST Offset: is 1 
>      Zone Offset: is 10 
> 
> [damian@homer damian]$ date
> Fri Mar 10 07:40:30 EST 2000
> 
> 
> 
> Damian
> 
> John Summerfield wrote:
> > 
> > Linux says the date here is:
> > [summer@possum jakarta-watchdog]$ date
> > Thu Mar  9 09:13:53 WST 2000
> > [summer@possum jakarta-watchdog]$
> > 
> > Tomcat's example says:
> > Day of month: is 9
> >       Year: is 2000
> >       Month: is March
> >       Time: is 5:12:15
> >       Date: is 3/9/2000
> >       Day: is Thursday
> >       Day Of Year: is 69
> >       Week Of Year: is 11
> >       era: is 1
> >       DST Offset: is 0
> >       Zone Offset: is 4
> > 
> > I don't know where it gets this information, my locale is set correctly
> > (Perth, Western Australia); the header in my outgoing mail will show this.
> > 
> > Note too, the date here is 9/3/2000. We do NOT follow American conventions
> > in our dates.
> > 
> > --
> > Cheers
> > John Summerfield
> > http://os2.ami.com.au/os2/ for OS/2 support.
> > Configuration, networking, combined IBM ftpsites index.
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: general-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
> 

-- 
Cheers
John Summerfield
http://os2.ami.com.au/os2/ for OS/2 support.
Configuration, networking, combined IBM ftpsites index.



Re: tomcat 3.1 beta; bad locale information.

Posted by Damian Fauth <df...@access.fairfax.com.au>.
John Summerfield wrote:
> 
> > Works for me on RedHat 6.0 sun's jdk 1.2.2 (I am GMT +11). What jdk are
> > you using?
> 
> Sorry. I should know better.
> 
> [summer@possum summer]$ java   -fullversion
> java full version "JDK 1.1.8 IBM build l118-19991013 (JIT enabled: jitc)"
> [summer@possum summer]$

I recall having this problem on Solaris with JDK1.1. Basically java 1.1
defines 32 time zones - for example East Coast Australia is 'AET', but
everyone here in the eastern states commonly uses EST (as Solaris does),
which java 1.1 thinks is East Coast USA - hence the confusion. It is
fixed in JDK1.2. I recall seeing an email thread where people in Britain
had the same problem - they use BST and java 1.1 thinks that is in
Bangladesh or somewhere! I'll bet that java 1.1 has defined WST as
somewhere 4 hours behind WA


I used the following to overcome the problem:

    /**
     * main entry point for application
     *
     * @param args Command line arguments
     * @return void
     */
    public static void main(String[] args) throws IOException {

        // Overcoming timezone bug
        TimeZone timeZone = TimeZone.getTimeZone("AET");
        TimeZone.setDefault(timeZone);


Regards,

Damian


-- 
Damian Fauth                                
dfauth@access.fairfax.com.au
Senior Software Engineer                                     Ph 9282
3528
Fairfax Interactive Networks (f2) Ltd                       FAX 9282
2256
201 Sussex Street, Sydney, NSW, 2000, Australia     
http://www.f2.com.au