You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "himabindu peram (JIRA)" <xa...@xml.apache.org> on 2009/01/12 10:32:59 UTC

[jira] Created: (XALANJ-2477) issue in exslt:dateTime() function

issue in exslt:dateTime() function
----------------------------------

                 Key: XALANJ-2477
                 URL: https://issues.apache.org/jira/browse/XALANJ-2477
             Project: XalanJ2
          Issue Type: Bug
      Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects.  Anybody can view the issue.)
          Components: XSLTC
    Affects Versions: 2.7
            Reporter: himabindu peram


When we are  looking at the code in Xalan-j.2.7.0 and it appears to be a bug in the code related to the time-zone calculation of dateTime() .

        int min = offset%(60*60*1000);
Should have been 

        int min = (offset%(60*60*1000))/ 60*1000;

Code from Xalan-j.2.7.0

    public static String dateTime()
    {
      Calendar cal = Calendar.getInstance();
      Date datetime = cal.getTime();
      // Format for date and time.
      SimpleDateFormat dateFormat = new SimpleDateFormat(dt);
      
      StringBuffer buff = new StringBuffer(dateFormat.format(datetime));
      // Must also include offset from UTF.
      // Get the offset (in milliseconds).
      int offset = cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET);
      // If there is no offset, we have "Coordinated
      // Universal Time."
      if (offset == 0)
        buff.append("Z");
      else
      {
        System.out.println(offset);
        // Convert milliseconds to hours and minutes
        int hrs = offset/(60*60*1000);
        // In a few cases, the time zone may be +/-hh:30.
        int min = offset%(60*60*1000);
        char posneg = hrs < 0? '-': '+';
        buff.append(posneg + formatDigits(hrs) + ':' + formatDigits(min));
      }
      return buff.toString();
    }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org