List of usage examples for java.util Calendar getInstance
public static Calendar getInstance()
From source file:Main.java
public static String getDay() { Calendar calendar = Calendar.getInstance(); int day = calendar.get(Calendar.DAY_OF_MONTH); return Integer.toString(day); }
From source file:Main.java
public static String getTodaysDate() { Calendar c = Calendar.getInstance(); return c.get(Calendar.YEAR) + "-0" + String.valueOf(c.get(Calendar.MONTH) + 1) + "-" + c.get(Calendar.DAY_OF_MONTH); }
From source file:Main.java
public static int getCurrentMin() { Calendar date = Calendar.getInstance(); return date.get(Calendar.MINUTE); }
From source file:Main.java
public static boolean isDay() { Calendar calendar = Calendar.getInstance(); int time = calendar.get(Calendar.HOUR_OF_DAY); return time >= 6 && time < 18; }
From source file:Main.java
public static int currentDay() { Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.DAY_OF_MONTH); }
From source file:Main.java
public static long getLocalTime() { Calendar cal = Calendar.getInstance(); return cal.getTimeInMillis(); }
From source file:Main.java
public static String getCurrentData() { Calendar c = Calendar.getInstance(); return "" + c.get(Calendar.YEAR) + c.get(Calendar.MONTH) + c.get(Calendar.DAY_OF_MONTH); }
From source file:Main.java
public static long today9am() { Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, 9); c.set(Calendar.MINUTE, 0);//www . j a 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 int getMonth() { Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.MONTH) + 1; }
From source file:Main.java
public static String getTimestamp() { Calendar cal = Calendar.getInstance(); return Long.toString(cal.getTimeInMillis() / 1000); }