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: [email protected]
For additional commands, e-mail: [email protected]