Android examples for java.util:Date Compare
Converts the Java timestamp to the iOS timestamp and create a Date object from the iOS timestamp.
import android.util.Log; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class Main{ /** The reference date of the iOS system. */ public static final long NS_DATE_REFERENCE_SEC = 978307200; /**/*from w ww. j a va 2 s. c o m*/ * Converts the Java timestamp to the iOS timestamp and create a Date object * from the iOS timestamp. * */ public static Date getDateFromTimestamp(long timestamp) { long time = (timestamp - (NS_DATE_REFERENCE_SEC * 1000)) / 1000; return new Date(time); } }