Re: date comes up wrong..

David Rosenstrauch <[email protected]> Tue, 27 Aug 2002 09:44:13 -0400
Newsgroups gmane.comp.windows.devel.java.general
Message-ID <5.1.1.6.1.20020827094022.025297c8@usmail02>
Calendar.getInstance() will give you a calendar set to the current
date/time of the client machine.  So if the date is wrong I would think it
has to be because the system date/time is wrong.

Which JDK & OS are you using?


DR


At 10:17 AM 8/27/2002 -02-30, you wrote:
>Hi, I'm getting the date via
>
>/* Gets the current date and returns it as a string */
>     private String getCurDate()
>     {
>         Calendar d = Calendar.getInstance();
>         Date d1 = d.getTime();
>         DateFormat df = DateFormat.getDateInstance();
>         return df.format(d1);
>     }
>but it always thinks its a day ahead.. (like it thinks today is the 28th
>but its the 27th, and the date on my server and the machine that the
>applets comes up on says its the 27th also..)
>
>why is it doing that?
>
>I also tried
>/* Gets the current date and returns it as a string */
>     private String getCurDate()
>     {
>         Date d1 = new date
>         DateFormat df = DateFormat.getDateInstance();
>         return df.format(d1);
>     }
>
>but that gave the same result..
>
>thanks
>sohaila

You can read messages from the JAVA archive, unsubscribe from JAVA,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.