Here you can find the source of calculateOffsetFromGMT(Date date)
Parameter | Description |
---|---|
gmtDate | the input GMT date. |
public static Long calculateOffsetFromGMT(Date date)
//package com.java2s; /*//w ww . j a va2 s . co m * All GTAS code is Copyright 2016, Unisys Corporation. * * Please see LICENSE.txt for details. */ import java.util.Calendar; import java.util.Date; public class Main { /** * Calculates a date time offset from GMT. * * @param gmtDate * the input GMT date. * @return the local date. */ public static Long calculateOffsetFromGMT(Date date) { Calendar cal = Calendar.getInstance(); /* * get the default time zone object and then calculate the signed offset * from GMT. */ long offset = cal.getTimeZone().getOffset(date.getTime()); return offset; } }