Java Month of Year create(final int year, final int month, final int day)

Here you can find the source of create(final int year, final int month, final int day)

Description

create

License

Open Source License

Declaration

public static Calendar create(final int year, final int month,
            final int day) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2009 Lifeform Software.
 * 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:/* ww  w.j a v a  2 s .  co m*/
 *     Ernan Hughes - initial API and implementation
 *******************************************************************************/

import java.util.Calendar;

public class Main {
    public static Calendar create(final int year, final int month,
            final int day) {
        return create(year, month, day, 0, 0, 0);
    }

    public static Calendar create(final int year, final int month,
            final int dayOfMonth, final int hourOfDay, final int minute,
            final int second) {
        Calendar calendar = Calendar.getInstance();
        calendar.clear();
        calendar.set(year, month - 1, dayOfMonth, hourOfDay, minute, second);
        return calendar;
    }

    public static Calendar create(final int year, final int month,
            final int dayOfMonth, final int hourOfDay, final int minute,
            final int second, final int milliSecond) {
        Calendar calendar = create(year, month - 1, dayOfMonth, hourOfDay,
                minute, second);
        calendar.set(Calendar.MILLISECOND, milliSecond);
        return calendar;
    }
}

Related

  1. create(int year, int month, int day)
  2. create(int year, int month, int day, int hour, int minute, int second)
  3. createKey(int instance, int year, int month, int day, int hour, int min, int sec, int milli, String uuid, boolean rolling)
  4. createTimestamp(int year, int month, int day, int hour, int minutes, int seconds)