Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { private static final SimpleDateFormat DATE_AND_TIME_FORMAT = new SimpleDateFormat("yyyyMMddHHmm", Locale.getDefault()); public static Calendar parseDateAndTime(String dateAndTime) { Calendar calendar = Calendar.getInstance(); try { calendar.setTime(DATE_AND_TIME_FORMAT.parse(dateAndTime)); } catch (Exception e) { e.printStackTrace(); } return calendar; } }