var OffSetMinute = new Date().getTimezoneOffset();
OffSetMinute var will give the difference in minutes between UTC and local time. The offset is positive if the local time zone is outside UTC and negative if it is ahead.
As @Guillaume said in a comment, the specified method is canceled, so you can use the following
private static final Calendar cal = new Calendar(); private static final int LOCALTIMEZONEOFFSET = (cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET)) / (60*1000);
Calendar.ZONE_OFFSET gives the standard offset (in msecs) from UTC . This does not change with DST. (Daylight)
Calendar.DST_OFFSET gives the current DST offset (in msecs) - if any. For example, in the summer in a country using DST, this field most likely has a value +1 hour (1000*60*60 msecs) .
so just ADD int LOCALTIMEZONEOFFSET Value (if positive) or substarct value (if your value is negative) in your UTC Time , and this will give you time for the client computer.
source share