Here you can find the source of getLocalTimeFromUTCMillis(long utcMillis)
Parameter | Description |
---|---|
utcMillis | a parameter |
static long getLocalTimeFromUTCMillis(long utcMillis)
//package com.java2s; import java.util.Calendar; public class Main { /**/*from ww w . j av a 2s . c o m*/ * Convert a UTC timestamp into device local time * * @param utcMillis * @return */ static long getLocalTimeFromUTCMillis(long utcMillis) { return utcMillis - getTimeZoneOffsetInMillis(); } /** * @return the timezone offset of the current device relative to UTC */ static long getTimeZoneOffsetInMillis() { Calendar cal = Calendar.getInstance(); return cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); } }