private Calendar asCalendar ( Calendar base , Time time ) { // Get calendar from given SQL time Calendar timeCalendar = Calendar . getInstance ( ) ; timeCalendar . setTime ( time ) ; // Apply given time to base calendar base . set ( Calendar . HOUR_OF_DAY , timeCalendar . get ( Calendar . HOUR_OF_DAY ) ) ; base . set ( Calendar . MINUTE , timeCalendar . get ( Calendar . MINUTE ) ) ; base . set ( Calendar . SECOND , timeCalendar . get ( Calendar . SECOND ) ) ; base . set ( Calendar . MILLISECOND , timeCalendar . get ( Calendar . MILLISECOND ) ) ; return base ; }
Converts a SQL Time to a Calendar independently of time zone using the given Calendar as a base . The time components will be copied to the given Calendar verbatim leaving the date and time zone components of the given Calendar otherwise intact .