Java Date UTC Parse getUTCDate(int year, int month, int date, int h, int m, int s, int milli)

Here you can find the source of getUTCDate(int year, int month, int date, int h, int m, int s, int milli)

Description

Retuns a UTC date.

License

Open Source License

Parameter

Parameter Description
year a parameter
month a parameter
date a parameter
h a parameter
m a parameter
s a parameter
milli a parameter

Return

The date.

Declaration

public static Date getUTCDate(int year, int month, int date, int h, int m, int s, int milli) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 Obeo./*from   w w w  . j  a  v  a2 s . c o  m*/
 * 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:
 *     Obeo - initial API and implementation
 *******************************************************************************/

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;

public class Main {
    /**
     * Retuns a UTC date.
     * 
     * @param year
     * @param month
     * @param date
     * @param h
     * @param m
     * @param s
     * @param milli
     * @return The date.
     */
    public static Date getUTCDate(int year, int month, int date, int h, int m, int s, int milli) {
        GregorianCalendar c = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
        c.set(year, month, date, h, m, s);
        c.set(Calendar.MILLISECOND, milli);
        return c.getTime();
    }
}

Related

  1. getUTCDate()
  2. getUTCDate()
  3. getUTCDate(Date date)
  4. getUtcDate(Date date)
  5. getUtcDate(final int year, final int month, final int day)
  6. getUTCDate(int year, int month, int day)
  7. getUTCMidnightZero(Date d)
  8. parseDateAsUTC(String dateString)
  9. parsePartialUTCToDate(String utcDate)