List of usage examples for java.util Calendar getInstance
public static Calendar getInstance()
From source file:Main.java
public static int getCurrentDayOfWeek() { Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.DAY_OF_WEEK); }
From source file:Main.java
public static long getCurrentTimeInMillisecs() { Calendar cal = Calendar.getInstance(); return cal.getTimeInMillis(); }
From source file:Main.java
public static boolean isExpired(long expiration) { Calendar c = Calendar.getInstance(); return c.getTimeInMillis() >= expiration; }
From source file:Main.java
public static String getRemoteDir() { Calendar calendar = Calendar.getInstance(); String str = calendar.get(Calendar.YEAR) + "_" + (calendar.get(Calendar.MONTH) + 1) + "_" + calendar.get(Calendar.DAY_OF_MONTH); return str;/*www. ja v a2 s . c o m*/ }
From source file:Main.java
public static int getCurrentDayOfMonth() { Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.DAY_OF_MONTH); }
From source file:Main.java
public static int getCurrentMouth() { Calendar cal = Calendar.getInstance(); int year = cal.get(Calendar.YEAR); int mouth = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DATE); int currentIndex = (year - 1970) * 12 + mouth; return currentIndex; }
From source file:Main.java
public static long getLocalToUtcDelta() { Calendar local = Calendar.getInstance(); local.clear();/*from w w w . j a v a 2 s. c o m*/ local.set(1970, Calendar.JANUARY, 1, 0, 0, 0); return local.getTimeInMillis(); }
From source file:Main.java
public static Date getTimeYearNext() { Calendar.getInstance().add(Calendar.DAY_OF_YEAR, 183); return Calendar.getInstance().getTime(); }
From source file:Main.java
public static int getCurrentMonthOfYear() { Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.MONTH); }
From source file:Main.java
public static long getTimesNextStart() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 24); cal.set(Calendar.SECOND, 0);//from w w w . j a v a 2 s .co m cal.set(Calendar.MINUTE, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }