This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Offsetting systime  RSS feed

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I'm retrieving the systime using the Date class and offsetting it to SGT using SinpleTimeZone. The code works fine in Java 1.1.7 environment but fails on the Java 1.1.3 environ.
SimpleTimeZone stz = new SimpleTimeZone(+8*60*60*1000,"Asia/Singapore");
SimpleTimeZone.setDefault(stz);
formatter = new SimpleDateFormat("ddMMMyyyy hh:mm:ss a");
Date date = new Date();
StringBuffer timeStampBuff = new StringBuffer();
System.out.println(formatter.format(date).toString());
Is this a known bug or something which I have missed out.
Thanks in advance,
Mahesh
 
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you SERIOUSLY trying to use the 1.1.3 jdk? Or did you mean the 1.3.1 jdk?
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This looks like the bug that you are running into:

Bug Id 4065244

Votes 6

Synopsis TimeZone NightMare.... The movie...

Category java:classes_util

Reported Against 1.1.1, 1.1.3

Release Fixed

State Closed, duplicate of 4069784

Related Bugs

Submit Date Jul 16, 1997

Description
HI,
We are currently coding an application using timezone
and I have some problem with the time zone return by java.util.Date
On Solarix 2.5.1, if I do a

import java.util.Date;
class tt
{
public static void main(String args[])
throws java.text.ParseException
{
Date d;
d = new Date();
double tz;
tz = d.getTimezoneOffset();
System.out.println(tz+" mins");
System.out.println((tz/60.0)+" hours\n");
System.out.println(d.toString());
System.out.println(d.toGMTString());
}
}


This threads to several other Bugs that more closely resemble yours. Sign on to Sun and read all about it. .
[ August 20, 2002: Message edited by: Cindy Glass ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!