Here you can find the source of getUTCDate(int year, int month, int date, int h, int m, int s, int milli)
Parameter | Description |
---|---|
year | a parameter |
month | a parameter |
date | a parameter |
h | a parameter |
m | a parameter |
s | a parameter |
milli | a parameter |
public static Date getUTCDate(int year, int month, int date, int h, int m, int s, int milli)
//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(); } }