List of usage examples for java.util Date Date
public Date()
From source file:Main.java
public static void main(String[] argv) throws Exception { Format formatter = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z"); String s = formatter.format(new Date()); }
From source file:MainClass.java
public static void main(String[] args) { //Format Date into ISO_DATE_FORMAT System.out.println("3) ISO_DATE_FORMAT >>>" + DateFormatUtils.ISO_DATE_FORMAT.format(new Date())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { // The hour (1-12) Format formatter = new SimpleDateFormat("h"); String s = formatter.format(new Date()); System.out.println(s);/*from w w w. j ava 2s . c om*/ }
From source file:Main.java
public static void main(String[] argv) { Instant instantFromDate = new Date().toInstant(); Instant instantFromCalendar = Calendar.getInstance().toInstant(); System.out.println(instantFromCalendar); ZoneId zoneId = java.util.TimeZone.getDefault().toZoneId(); System.out.println(zoneId);//from www .java 2 s.c om ZonedDateTime zonedDateTimeFromGregorianCalendar = new GregorianCalendar().toZonedDateTime(); System.out.println(zonedDateTimeFromGregorianCalendar); }
From source file:Main.java
public static void main(String[] argv) { JFormattedTextField tft2 = new JFormattedTextField(DateFormat.getDateInstance(DateFormat.SHORT)); tft2.setValue(new Date()); }
From source file:Main.java
public static void main(String[] args) { Date now = new Date(); DateFormat defaultFormat = DateFormat.getDateTimeInstance(); String defaultString = defaultFormat.format(now); System.out.println("Default : " + defaultString); DateFormat antarcticaFormat = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, new Locale("en", "AQ")); String antarcticaString = antarcticaFormat.format(now); System.out.println("Antarctica: " + antarcticaString); }
From source file:Test.java
public static void main(String[] args) { long SAMPLE_NUMBER = 123456789L; Date NOW = new Date(); String[][] langRegions = { { "fr", "FR" }, { "ja", "JP" }, { "en", "US" } }; Builder builder = new Builder(); Locale l = null;//from ww w . ja v a 2 s .c om for (String[] lr : langRegions) { builder.clear(); builder.setLanguage(lr[0]).setRegion(lr[1]); l = builder.build(); displayLocalizedData(l, SAMPLE_NUMBER, NOW); } }
From source file:Main.java
public static void main(String[] argv) throws Exception { Format formatter = new SimpleDateFormat("EEEE, dd MMMM yyyy, hh:mm:ss.SSS a"); String today = formatter.format(new Date()); System.out.println("Today : " + today); }
From source file:Main.java
public static void main(String args[]) { int style = DateFormat.MEDIUM; // Also try with style = DateFormat.FULL and DateFormat.SHORT Date date = new Date(); DateFormat df;//from w w w .j ava2 s .c o m df = DateFormat.getDateInstance(style, Locale.UK); System.out.println("United Kingdom: " + df.format(date)); df = DateFormat.getDateInstance(style, Locale.US); System.out.println("USA: " + df.format(date)); df = DateFormat.getDateInstance(style, Locale.FRANCE); System.out.println("France: " + df.format(date)); df = DateFormat.getDateInstance(style, Locale.ITALY); System.out.println("Italy: " + df.format(date)); df = DateFormat.getDateInstance(style, Locale.JAPAN); System.out.println("Japan: " + df.format(date)); }
From source file:ShowDate.java
public static void main(String[] args) { DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, Locale.CANADA_FRENCH); System.out.println(df.format(new Date())); }