Hi Federico!
It may be if you use two computer - client (where you are running java
program) and server (where are invoked servlet) time has different values
(your 2 hors)
Check time in both computer
Regads
Viktar
-----Original Message-----
From: Federico Delpino [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 27, 1999 12:48 PM
To: [EMAIL PROTECTED]
Subject: Problem with date
Hi all, I have a problem using dates in servlets. The
following code
=====
Calendar now = Calendar.getInstance();
String date = now.get(Calendar.DATE) +
"/" + (now.get(Calendar.MONTH) +1) +
"/" + now.get(Calendar.YEAR) +
" " + now.get(Calendar.HOUR_OF_DAY)+
":" + now.get(Calendar.MINUTE)+
":" + now.get(Calendar.SECOND);
System.out.println(date);
==================
in a Java application returns the correct date. Yet the same
code inside
a servlet running on the same system gives me a different
value (2 hours
in advance). Where I'm wrong ??
Thanks.
federico
------------------------------------------------------------
------
Federico Delpino Tel. 39-51-20-95722
Osservatorio Astronomico di Bologna Fax. 39-51-20-95700
via Ranzani,1 - 40126 Bologna, Italy e-mail:
[EMAIL PROTECTED]
___________________________________________________________________________
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