Java Date UTC Parse getUTCDate(int year, int month, int day)

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

Description

get UTC Date

License

Open Source License

Declaration

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

Method Source Code

//package com.java2s;
/*//from w w  w.  ja v  a2 s . c o  m
Copyright (c) Microsoft Open Technologies, Inc.
All Rights Reserved
See License.txt in the project root for license information.
*/

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

import java.util.TimeZone;

public class Main {
    public static Date getUTCDate(int year, int month, int day) {

        return getUTCDate(year, month, day, 0, 0, 0);
    }

    public static Date getUTCDate(int year, int month, int day, int hour, int minute, int second) {
        GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("utc"));
        int dateMonth = month - 1;
        calendar.set(year, dateMonth, day, hour, minute, second);
        calendar.set(Calendar.MILLISECOND, 0);

        return calendar.getTime();
    }
}

Related

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