List of usage examples for java.util Calendar getInstance
public static Calendar getInstance()
From source file:Main.java
private static long currentTime() { Calendar time = Calendar.getInstance(); time.add(Calendar.MILLISECOND, -time.getTimeZone().getOffset(time.getTimeInMillis())); return time.getTime().getTime(); }
From source file:Main.java
public static int timeZoneOffset() { Calendar cal = Calendar.getInstance(); int offset = (cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET)) / (60 * 1000); return offset; }
From source file:Main.java
public static int getNowDay() { Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.DATE); }
From source file:Main.java
public static int getCurrentDay() { Calendar cal = Calendar.getInstance(); int day = cal.get(Calendar.DATE); return day;/* w w w . j a v a 2 s .c o m*/ }
From source file:Main.java
public static String getYear() { Calendar calendar = Calendar.getInstance(); return String.valueOf(calendar.get(Calendar.YEAR)); }
From source file:Main.java
public static String getTimestamp() { Calendar cal = Calendar.getInstance(); long timestamp = cal.getTimeInMillis() / 1000; return String.valueOf(timestamp); }
From source file:Main.java
static public int getSecond() { Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.SECOND); }
From source file:Main.java
public static Calendar getCurrentTime() { Calendar cal = Calendar.getInstance(); return cal; }
From source file:Main.java
public static long getTodayMills() { Calendar c = Calendar.getInstance(); c.setTimeInMillis(System.currentTimeMillis()); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0);// w w w. ja v a 2 s.c o m c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); return c.getTimeInMillis(); }
From source file:Main.java
public static long getTimesEnd() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.MILLISECOND, 999); return cal.getTimeInMillis(); }