List of usage examples for java.util Calendar getInstance
public static Calendar getInstance()
From source file:Main.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); System.out.printf("Last key: %s\tLast entry: %s%n", nav.lastKey(), nav.lastEntry()); }
From source file:Main.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); System.out.printf("Key floor before Sunday: %s%n", nav.floorKey("Sunday")); }
From source file:Main.java
public static void main(String[] argv) { System.out.println(convertDateToStringRfc822(Calendar.getInstance(), Locale.ENGLISH)); }
From source file:MainClass.java
public static void main(String args[]) { Calendar calendar1 = Calendar.getInstance(); int doy1 = calendar1.get(Calendar.DAY_OF_YEAR); int year = calendar1.get(Calendar.YEAR); Calendar calendar2 = new GregorianCalendar(year, 11, 31); int doy2 = calendar2.get(Calendar.DAY_OF_YEAR); int days = doy2 - doy1; System.out.println(days + " days remain in current year"); }
From source file:Main.java
public static void main(String[] args) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); // call the getdisplaynames method Map<String, Integer> representations = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> navMap = new TreeMap<String, Integer>(representations); // print the results System.out.printf("Whole list:%n%s%n", navMap); }
From source file:NavigableMapSample.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); }
From source file:Main.java
public static void main(String[] args) { Date d1 = new Date(); Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, 22);/* w ww . j av a 2s . co m*/ Date d2 = cal.getTime(); Iterator<Date> i = new DateIterator(d1, d2); while (i.hasNext()) { Date date = i.next(); System.out.println(date); } }
From source file:NavigableMapSample.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); System.out.printf("Key lower before Sunday: %s%n", nav.lowerKey("Sunday")); }
From source file:NavigableMapSample.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); System.out.printf("Key ceiling after Sunday: %s%n", nav.ceilingKey("Sunday")); }
From source file:NavigableMapSample.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); System.out.printf("First key: %s\tFirst entry: %s%n", nav.firstKey(), nav.firstEntry()); }