List of utility methods to do Calendar Millisecond
boolean | hasZeroMilliSeconds(Calendar cal) has Zero Milli Seconds return !cal.isSet(Calendar.MILLISECOND) || cal.get(Calendar.MILLISECOND) == 0;
|
Calendar | newCalendar(long timeInMillis) new Calendar Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(timeInMillis);
return calendar;
|
void | setCalendar(Calendar calendar, int wholeDays, int millisecondsInDay, boolean use1904windowing) set Calendar int startYear = 1900; int dayAdjust = -1; if (use1904windowing) { startYear = 1904; dayAdjust = 1; } else if (wholeDays < 61) { dayAdjust = 0; calendar.set(startYear, 0, wholeDays + dayAdjust, 0, 0, 0); calendar.set(GregorianCalendar.MILLISECOND, millisecondsInDay); |
void | setCalendar(Calendar calendar, int wholeDays, int millisecondsInDay, boolean use1904windowing, boolean roundSeconds) set Calendar int startYear = 1900; int dayAdjust = -1; if (use1904windowing) { startYear = 1904; dayAdjust = 1; } else if (wholeDays < 61) { dayAdjust = 0; calendar.set(startYear, 0, wholeDays + dayAdjust, 0, 0, 0); calendar.set(Calendar.MILLISECOND, millisecondsInDay); if (calendar.get(Calendar.MILLISECOND) == 0) { calendar.clear(Calendar.MILLISECOND); if (roundSeconds) { calendar.add(Calendar.MILLISECOND, 500); calendar.clear(Calendar.MILLISECOND); |
void | setCalendarTime(Calendar inCalendar, int hr, int min, int sec, int milliSec) Call this function to set the time section of a calendar if (inCalendar != null) { if (hr != -1) { inCalendar.set(Calendar.HOUR_OF_DAY, hr); if (min != -1) { inCalendar.set(Calendar.MINUTE, min); if (sec != -1) { ... |
void | setTimeInMillis(Calendar _calendar, long _timemillis) set Time In Millis java.util.Date dDate = new java.util.Date();
dDate.setTime(_timemillis);
_calendar.setTime(dDate);
|
Calendar | toCalendar(final long millis) Creates an instance of java.util.Calendar from the given time in milliseconds. final Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(millis); return calendar; |
Calendar | toCalendar(long millis) to Calendar Calendar cal = new GregorianCalendar(); cal.setTime(new Date(millis)); return cal; |
String | toStringDateTimeMillisecond(Calendar calendar) to String Date Time Millisecond String yyyy = String.valueOf(calendar.get(Calendar.YEAR) + BUDDHIST_YEAR);
String mm = String.valueOf(calendar.get(Calendar.MONTH) + 1);
String dd = String.valueOf(calendar.get(Calendar.DAY_OF_MONTH));
String hh = String.valueOf(calendar.get(Calendar.HOUR_OF_DAY));
String nn = String.valueOf(calendar.get(Calendar.MINUTE));
String ss = String.valueOf(calendar.get(Calendar.SECOND));
String ms = String.valueOf(calendar.get(Calendar.MILLISECOND));
if (mm.length() < 2) {
...
|
long | translateToMilliseconds(Calendar calendar) Translate the calendar to a number of millisec since 01/01/2000 return translateToDayNumber(calendar) * 86400000 + calendar.get(Calendar.HOUR_OF_DAY) * 3600000
+ calendar.get(Calendar.MINUTE) * 60000 + calendar.get(Calendar.SECOND) * 1000
+ calendar.get(Calendar.MILLISECOND);
|