Here you can find the source of getUtcDate(Date date)
public static Date getUtcDate(Date date)
//package com.java2s; /*/* w w w . j a v a 2 s .c o m*/ * Copyright (c) 2015 Cisco Systems, Inc. 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 */ import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Main { public static Date getUtcDate(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); TimeZone z = calendar.getTimeZone(); int offset = z.getRawOffset(); if (z.inDaylightTime(new Date())) { offset = offset + z.getDSTSavings(); } int offsetHrs = offset / 1000 / 60 / 60; int offsetMins = offset / 1000 / 60 % 60; calendar.add(Calendar.HOUR_OF_DAY, (-offsetHrs)); calendar.add(Calendar.MINUTE, (-offsetMins)); return calendar.getTime(); } }