public void setExplicitTime ( String hours , String minutes , String seconds , String amPm , String zoneString ) { int hoursInt = Integer . parseInt ( hours ) ; int minutesInt = minutes != null ? Integer . parseInt ( minutes ) : 0 ; assert ( amPm == null || amPm . equals ( AM ) || amPm . equals ( PM ) ) ; assert ( hoursInt >= 0 ) ; assert ( minutesInt >= 0 && minutesInt < 60 ) ; markTimeInvocation ( amPm ) ; // reset milliseconds to 0 _calendar . set ( Calendar . MILLISECOND , 0 ) ; // if no explicit zone is given, we use our own TimeZone zone = null ; if ( zoneString != null ) { if ( zoneString . startsWith ( PLUS ) || zoneString . startsWith ( MINUS ) ) { zoneString = GMT + zoneString ; } zone = TimeZone . getTimeZone ( zoneString ) ; } _calendar . setTimeZone ( zone != null ? zone : _defaultTimeZone ) ; _calendar . set ( Calendar . HOUR_OF_DAY , hoursInt ) ; // hours greater than 12 are in 24-hour time if ( hoursInt <= 12 ) { int amPmInt = amPm == null ? ( hoursInt >= 12 ? Calendar . PM : Calendar . AM ) : amPm . equals ( PM ) ? Calendar . PM : Calendar . AM ; _calendar . set ( Calendar . AM_PM , amPmInt ) ; // calendar is whacky at 12 o'clock (must use 0) if ( hoursInt == 12 ) hoursInt = 0 ; _calendar . set ( Calendar . HOUR , hoursInt ) ; } if ( seconds != null ) { int secondsInt = Integer . parseInt ( seconds ) ; assert ( secondsInt >= 0 && secondsInt < 60 ) ; _calendar . set ( Calendar . SECOND , secondsInt ) ; } else { _calendar . set ( Calendar . SECOND , 0 ) ; } _calendar . set ( Calendar . MINUTE , minutesInt ) ; }
Sets the the time of day