Tutorial by Examples

To Convert you date in dd/MM/yyyy format into milliseconds you call this function with data as String public long getMilliFromDate(String dateFormat) { Date date = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); try { date = formatter.p...
This example will help to verify the given time is within a period or not. To check the time is today, We can use DateUtils class boolean isToday = DateUtils.isToday(timeInMillis); To check the time is within a week, private static boolean isWithinWeek(final long millis) { return System.c...
This calculate current device time and add/subtract difference between real and device time public static Calendar getCurrentRealTime() { long bootTime = networkTime - SystemClock.elapsedRealtime(); Calendar calInstance = Calendar.getInstance(); calInstance.setTimeZone(getUTCTimeZo...

Page 1 of 1