Java Month of Year getTime(int year, int month, int day)

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

Description

get Time

License

Open Source License

Declaration

public static Date getTime(int year, int month, int day) 

Method Source Code

//package com.java2s;
/*/*from ww  w.  jav  a  2s .  c  om*/
 * Copyright (c) 2004-2011 Marco Maccaferri 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:
 *     Marco Maccaferri - initial API and implementation
 */

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Date getTime(int year, int month, int day) {
        Calendar date = Calendar.getInstance();
        date.set(year, month, day, 0, 0, 0);
        date.set(Calendar.MILLISECOND, 0);
        return date.getTime();
    }

    public static Date getTime(int year, int month, int day, int hour,
            int minute) {
        Calendar date = Calendar.getInstance();
        date.set(year, month, day, hour, minute, 0);
        date.set(Calendar.MILLISECOND, 0);
        return date.getTime();
    }
}

Related

  1. getPreYearMonth()
  2. getSecondsOfMonth(int year, int month)
  3. getStartAndEndOfMonth(int month, int year)
  4. getStrDayOfWeek(int _year, int _month, int _day)
  5. getThisMonth(int year, int monthIndex)
  6. getTimeByYMD(int year, int month, int day)
  7. getTimestamp(int year, int month, int day, int hour, int minute, int second, int millisecond)
  8. getTodayAdd(int year, int month, int day)
  9. getWeek(int year, int month, int day)