Here you can find the source of getCalendar(int year, int month, int day, int hours, int minutes, int seconds, TimeZone tz)
public static GregorianCalendar getCalendar(int year, int month, int day, int hours, int minutes, int seconds, TimeZone tz)
//package com.java2s; /*/*from ww w .j av a2 s. c o m*/ * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Florent Guillaume */ import java.util.Calendar; import java.util.GregorianCalendar; import java.util.TimeZone; public class Main { /** * Gets a Calendar object. */ public static GregorianCalendar getCalendar(int year, int month, int day, int hours, int minutes, int seconds) { TimeZone tz = TimeZone.getTimeZone("GMT-02:00"); // in the Atlantic return getCalendar(year, month, day, hours, minutes, seconds, tz); } /** * Gets a Calendar object with a specific timezone */ public static GregorianCalendar getCalendar(int year, int month, int day, int hours, int minutes, int seconds, TimeZone tz) { GregorianCalendar cal = (GregorianCalendar) Calendar .getInstance(tz); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month - 1); // 0-based cal.set(Calendar.DAY_OF_MONTH, day); cal.set(Calendar.HOUR_OF_DAY, hours); cal.set(Calendar.MINUTE, minutes); cal.set(Calendar.SECOND, seconds); cal.set(Calendar.MILLISECOND, 0); return cal; } }