Here you can find the source of getCalendar(Object source)
public static Calendar getCalendar(Object source)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.TimeZone; public class Main { public static Calendar getCalendar(Object source) { String d = getString(source); Calendar c = Calendar.getInstance(); TimeZone t = TimeZone.getTimeZone("Etc/Universal"); c.setTimeZone(t);//from w ww . ja va 2 s. c o m SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); s.setTimeZone(t); try { c.setTime(s.parse(d)); return c; } catch (Exception e) { System.err.println(e.getMessage()); } return null; } public static String getString(Object o) { if (o == null) return null; return o.toString(); } }