Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static Calendar transformStringTimeToCalendar(String time) { Calendar calendar = Calendar.getInstance(); String[] split = time.split(":"); if (split.length > 0) { calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(split[0])); } if (split.length > 1) { calendar.set(Calendar.MINUTE, Integer.parseInt(split[1])); } if (split.length > 2) { calendar.set(Calendar.SECOND, Integer.parseInt(split[2])); } return calendar; } }