List of usage examples for java.util Calendar clear
public final void clear()
Calendar
undefined. From source file:Main.java
public static void main(String[] args) { int year = 2009; int month = 0; // January int date = 1; Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.DATE, date); java.util.Date utilDate = cal.getTime(); System.out.println(utilDate); }
From source file:Main.java
public static void main(String[] args) { int year = 2009; int month = 0; // January int date = 1; Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.DATE, date); java.sql.Date sqlDate = new java.sql.Date(cal.getTimeInMillis()); System.out.println(sqlDate);/*w ww .ja v a 2 s . c o m*/ }
From source file:Main.java
public static void main(String[] args) { // create calendar object Calendar cal = Calendar.getInstance(); // displays the current date and time System.out.println("Current Calendar Date: " + cal.getTime()); // use clear method to set all field values and time value as undefined. cal.clear(); // print the result System.out.println("The calendar shows : " + cal.getTime()); }
From source file:Main.java
public static Calendar getEmptyCalendarCurrentTimeZone() { Calendar calendar = Calendar.getInstance(); calendar.clear(); return calendar; }
From source file:Main.java
private static long beginningOfTheDay(Calendar time) { Calendar copy = (Calendar) time.clone(); copy.clear(); copy.set(time.get(Calendar.YEAR), time.get(Calendar.MONTH), time.get(Calendar.DAY_OF_MONTH)); return copy.getTimeInMillis(); }
From source file:Main.java
public static long getLocalToUtcDelta() { Calendar local = Calendar.getInstance(); local.clear(); local.set(1970, Calendar.JANUARY, 1, 0, 0, 0); return local.getTimeInMillis(); }
From source file:Main.java
public static Date makeDate(int year, int month, int day) { Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(year, month - 1, day, 0, 0, 0); return cal.getTime(); }
From source file:Main.java
public static int getWeekOfYear(String year, String month, String day) { Calendar cal = new GregorianCalendar(); cal.clear(); cal.set(new Integer(year).intValue(), new Integer(month).intValue() - 1, new Integer(day).intValue()); return cal.get(Calendar.WEEK_OF_YEAR); }
From source file:Main.java
public static Calendar createNewCalendar(int year, int month, int day) { Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.set(year, month - 1, day);/*from www . j a va 2s .com*/ return calendar; }
From source file:Main.java
public static int getDayOfWeek(int year, int week) { Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.WEEK_OF_YEAR, week); return calendar.get(Calendar.DAY_OF_MONTH); }