corrected calendar field used to calculate the offset when modifying the hour for a round or truncated based on AM_PM

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137881 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Steven Caswell 2004-07-12 00:04:32 +00:00
parent 2b026a32cf
commit 0c40162c2f
1 changed files with 3 additions and 3 deletions

View File

@ -31,7 +31,7 @@ import java.util.TimeZone;
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a> * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author Phil Steitz * @author Phil Steitz
* @since 2.0 * @since 2.0
* @version $Id: DateUtils.java,v 1.22 2004/07/11 18:40:04 stevencaswell Exp $ * @version $Id: DateUtils.java,v 1.23 2004/07/12 00:04:32 stevencaswell Exp $
*/ */
public class DateUtils { public class DateUtils {
@ -367,10 +367,10 @@ public class DateUtils {
} }
break; break;
case Calendar.AM_PM: case Calendar.AM_PM:
if (fields[i][0] == Calendar.HOUR) { if (fields[i][0] == Calendar.HOUR_OF_DAY) {
//If we're going to drop the HOUR field's value, //If we're going to drop the HOUR field's value,
// we want to do this our own way. // we want to do this our own way.
offset = val.get(Calendar.HOUR); offset = val.get(Calendar.HOUR_OF_DAY);
if (offset >= 12) { if (offset >= 12) {
offset -= 12; offset -= 12;
} }