I had a similar problem in that the time printed was for PST when I wanted
EST.  This worked for me:

Date dt = new Date();
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
fmt.setCalendar(Calendar.getInstance());
System.out.println(fmt.format(dt));

-ja

Andr�s Wagner wrote:

> >Try,  dateFormatter.setTimeZone(tz);
> >after you get the timezone.
>
> Ok, thanks.. but why does not take care of this the GregorianCalendar
> (TimeZone)???
> Anyway....
>
> My problem now is that the " TimeZone.inDayligthTime(Date)" does not
> return a true value and the zone is in SavingTime. And i can not find
> any method that increase the time when it is in "DayligthTime".
>
> Is always so hard to use Dates on JAVA? Is there any new version of
> the Date and Gregorian Calendar? I'm finishing a big servlet and I
> can't belive that the hardest thing of all the project is to put a
> simple Date...
>
> >
> >  >Here is my problem, I want display a servlet message with the current
> >>time, but I always get the "default" time zone although I create a
> >>new TimeZone.
> >>Ok, please tell me what I'm doing wrong, because i'm out of ideas....
> >>
> >>THE SOURCE:
> >>
> >>Locale aLocale = new Locale("es", "CL");
> >>
> >>DateFormat dateFormatter= DateFormat.getDateTimeInstance
> >>                 (DateFormat.FULL,DateFormat.FULL,aLocale);
> >>
> >>TimeZone tz = TimeZone.getTimeZone("EST");
> >>
> >>String myDate = dateFormatter.format((new
> >>GregorianCalendar(tz,aLocale)).getTime());
> >>
> >>System.out.println(myDate);
> >>
> >>
> >>Thanks again!
> >>
> >>--
> >  >__________________________________
> --
> __________________________________
> Andr�s Wagner Acu�a
> Estudiante Ing. Civil Industrial
> Universidad Adolfo Iba�ez
>
> ICQ: 39542425
> __________________________________
>
> "Programing today is a race between software engineers striving to
> build bigger and better idiot-proof programs, and the universe trying
> to produce bigger and better idiots...
>                                 ...So far the universe is winning".
>
> -Rich Cook
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to