Java Date Create date(int year, int month, int day, int hour, int minute, int second)

Here you can find the source of date(int year, int month, int day, int hour, int minute, int second)

Description

date

License

Open Source License

Declaration

public static Date date(int year, int month, int day, int hour, int minute, int second) 

Method Source Code


//package com.java2s;
/*/*from  ww  w . j  ava 2s  .  c  om*/
 *    Debrief - the Open Source Maritime Analysis Application
 *    http://debrief.info
 *
 *    (C) 2000-2014, PlanetMayo Ltd
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the Eclipse Public License v1.0
 *    (http://www.eclipse.org/legal/epl-v10.html)
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 */

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

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

    public static Date date(int year, int month, int day) {
        return date(year, month, day, 0, 0, 0);
    }
}

Related

  1. date(int year, int month, int day)
  2. date(int year, int month, int day)
  3. date(int year, int month, int day)
  4. date(int year, int month, int day)
  5. date(int year, int month, int day, int hour, int minute)
  6. longArrayTODateArray(long[] dates_s, SimpleDateFormat dateformat)
  7. longToDate(long time)
  8. objectToDate(Object Obj)
  9. timeToDate()