Android examples for java.util:Hour
get Calendar For Hour And Minus
//package com.java2s; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static Calendar getCalendarForHourAndMinus(String time) { if (null == time) { return new GregorianCalendar(); }/* w w w .j a v a 2 s. c o m*/ String[] times = time.split(":|??"); if (times == null || times.length != 2) { return new GregorianCalendar(); } int hour = Integer.parseInt(times[0]); int minus = Integer.parseInt(times[1]); Calendar calendar = new GregorianCalendar(); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MINUTE, minus); calendar.set(Calendar.SECOND, 0); return calendar; } }