List of usage examples for java.util Calendar getInstance
public static Calendar getInstance()
From source file:Main.java
public static int getCurrentDayOfWeekFromTimestamp() { Calendar currentTime = Calendar.getInstance(); return currentTime.get(Calendar.DAY_OF_WEEK); }
From source file:Main.java
public static Date getLastWeekTime() { Calendar c = Calendar.getInstance(); c.add(Calendar.DATE, -6); return c.getTime(); }
From source file:Main.java
public static Boolean isToday(long millis) { Calendar today = Calendar.getInstance(); today = clearTimes(today);/*from w w w.jav a2 s .com*/ if (millis > today.getTimeInMillis()) return true; return false; }
From source file:Main.java
public static long getTimeInitializeMills(long mills) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(mills);//w w w. ja v a 2 s .c o m c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); return c.getTimeInMillis(); }
From source file:Main.java
public static int getMonth(Date date) { Calendar c = Calendar.getInstance(); c.setTime(date);//from w ww. j a v a 2 s. com return c.get(Calendar.MONTH) + 1; }
From source file:Main.java
public static int getDayOfWeek(int year, int week) { Calendar calendar = Calendar.getInstance(); calendar.clear();//from w w w. j a va 2 s. c o m calendar.set(Calendar.YEAR, year); calendar.set(Calendar.WEEK_OF_YEAR, week); return calendar.get(Calendar.DAY_OF_MONTH); }
From source file:Main.java
private static Boolean isThisMonth(Calendar calendar) { Calendar nowCalendar = Calendar.getInstance(); return calendar.get(Calendar.MONTH) == nowCalendar.get(Calendar.MONTH); }
From source file:Main.java
public static Calendar getEmptyCalendarCurrentTimeZone() { Calendar calendar = Calendar.getInstance(); calendar.clear(); return calendar; }
From source file:Main.java
public static int getCurrentDayOfMonthFromTimestamp() { Calendar currentTime = Calendar.getInstance(); return currentTime.get(Calendar.DAY_OF_MONTH); }
From source file:Main.java
public static int[] getYMD(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);//from w ww.jav a 2s. c om return new int[] { cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DATE) }; }