List of usage examples for java.text DateFormat getDateInstance
public static final DateFormat getDateInstance()
From source file:Main.java
public static void main(String args[]) { DateFormat df1 = DateFormat.getDateInstance(); DateFormat df2 = DateFormat.getTimeInstance(); System.out.println(df1.equals(df2)); }
From source file:Main.java
public static void main(String args[]) { DateFormat df1 = DateFormat.getDateInstance(); System.out.println(df1.clone().equals(df1)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { String s = DateFormat.getDateInstance().format(new Date()); System.out.println(s);/* ww w .ja va 2 s.c om*/ }
From source file:Main.java
public static void main(String[] args) { DateFormat df = DateFormat.getDateInstance(); if (df instanceof SimpleDateFormat) { SimpleDateFormat sdf = (SimpleDateFormat) df; System.out.println(sdf.toPattern()); } else {/*www . j a va 2s. c o m*/ System.out.println("sorry"); } }
From source file:Main.java
public static void main(String[] argv) throws Exception { DateFormat dateFormat = DateFormat.getDateInstance(); String s = dateFormat.format(new Date()); System.out.println(s);//w ww. j av a 2s . c o m }
From source file:Main.java
public static void main(String[] argv) throws Exception { DateFormat dateFormat = DateFormat.getDateInstance(); StringBuffer sb = new StringBuffer(); sb = dateFormat.format(new Date(), sb, new FieldPosition(DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD)); System.out.println(sb);//from w w w . ja v a 2 s . c o m }
From source file:Main.java
public static void main(String args[]) { Date date = new Date(); Format formatter = new SimpleDateFormat("dd/MM/yyyy"); String s = formatter.format(date); System.out.println(s);/*from ww w. j a va2s. c o m*/ date = new Date(); String df = DateFormat.getDateInstance().format(date); System.out.println(df); }
From source file:Main.java
static String formatDate(long dateInDays) { Date date = new Date(dateInDays * 24 * 60 * 60 * 1000); return DateFormat.getDateInstance().format(date); }
From source file:Main.java
public static String formatDate(Date paramDate) { return format(paramDate, DateFormat.getDateInstance()); }
From source file:Main.java
public static boolean isToDay(Date date) { DateFormat dateFormat = DateFormat.getDateInstance(); String format = dateFormat.format(new Date()); try {//from w w w . j a va 2 s .c o m Date today = dateFormat.parse(format); return today.before(date); } catch (ParseException e) { e.printStackTrace(); } return true; }