You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "H.F.N. den Boer" <ni...@denboer-ims.nl> on 2001/04/18 20:55:11 UTC

Date problem with Tomcat/IIS

Made a class to do a number of usefull things.
One of them is to get the prefix string for a custom servlet-log.

In the generated string, the date is correct but the time is always the same.
Example of return value: 18-04-2001 11:12:13 

I'm working with;
Win2K server, build 5.00.2195
IIS 5.0, configured with ISAPI filter
JDK1.3.1beta
Tomcat 3.2.1 running as NT service

Below the code of the servlet.

Any ideas ?

Nico

  public String getLogDateTime() {
    StringBuffer retVal = new StringBuffer("");
    Date dt = new Date();
    cal = Calendar.getInstance();
    cal.setTime(dt);

    retVal.append(getDateOnlyNumbers(dt));  // add date
    retVal.append(" ");
    retVal.append(cal.HOUR_OF_DAY);         // add hour
    retVal.append(":");
    retVal.append(cal.MINUTE);              // add minute
    retVal.append(":");
    retVal.append(cal.SECOND);              // add second
    retVal.append(" ");

    return retVal.toString();
  }