List of usage examples for java.util Calendar setWeekDate
public void setWeekDate(int weekYear, int weekOfYear, int dayOfWeek)
From source file:Test.java
public static void main(String[] args) { Locale locale = Locale.getDefault(); Calendar calendar = Calendar.getInstance(); calendar.setWeekDate(2012, 16, 3); System.out.println(//from w ww. j ava 2s. c o m DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(calendar.getTime())); System.out.println("" + locale.getDisplayLanguage()); Locale.setDefault(Locale.Category.FORMAT, Locale.JAPANESE); Locale.setDefault(Locale.Category.DISPLAY, Locale.GERMAN); System.out.println( DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(calendar.getTime())); System.out.println("" + locale.getDisplayLanguage()); }
From source file:Main.java
public static void main(String[] args) { Calendar now = Calendar.getInstance(); System.out.println(now.getTime()); now.setWeekDate(2013, 12, 2); System.out.println(now.getTime()); }
From source file:Test.java
public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); calendar.setWeekDate(2012, 16, 3); Builder builder = new Builder(); builder.setLanguage("hy"); builder.setScript("Latn"); builder.setRegion("IT"); builder.setVariant("arevela"); Locale locale = builder.build(); Locale.setDefault(locale);// w w w .jav a 2 s . c om System.out.println( DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(calendar.getTime())); System.out.println("" + locale.getDisplayLanguage()); builder.setLanguage("zh"); builder.setScript("Hans"); builder.setRegion("CN"); locale = builder.build(); Locale.setDefault(locale); System.out.println( DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(calendar.getTime())); System.out.println("" + locale.getDisplayLanguage()); }
From source file:Test.java
public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); if (calendar.isWeekDateSupported()) { System.out.println("Number of weeks in this year: " + calendar.getWeeksInWeekYear()); System.out.println("Current week number: " + calendar.get(Calendar.WEEK_OF_YEAR)); }//from w w w .j ava 2 s .com calendar.setWeekDate(2012, 16, 3); System.out.println( DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(calendar.getTime())); }