Here you can find the source of getCalendarFromString(String time)
public static Calendar getCalendarFromString(String time)
//package com.java2s; import java.util.Calendar; public class Main { public static Calendar getCalendarFromString(String time) { String[] timeParts = time.split(":"); int hour = Integer.parseInt(timeParts[0]); int minute = Integer.parseInt(timeParts[1]); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MINUTE, minute); return calendar; }//from w w w . jav a 2 s .c om }