Example usage for java.text DateFormat getDateInstance

List of usage examples for java.text DateFormat getDateInstance

Introduction

In this page you can find the example usage for java.text DateFormat getDateInstance.

Prototype

public static final DateFormat getDateInstance(int style) 

Source Link

Document

Gets the date formatter with the given formatting style for the default java.util.Locale.Category#FORMAT FORMAT locale.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {

    String s = DateFormat.getDateInstance(DateFormat.DEFAULT).format(new Date());
    System.out.println(s);/*from   w w  w  .j av  a 2s .co  m*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    Date date = DateFormat.getDateInstance(DateFormat.DEFAULT).parse("Feb 28, 2002");
    System.out.println(date);// www.j  av  a2s  .  co  m
}

From source file:Main.java

public static void main(String[] args) {
    Date date = new Date();

    String strDate = DateFormat.getDateInstance(DateFormat.FULL).format(date);
    System.out.println(strDate);//from   w  w  w  .j  av a  2  s.  c o  m
}

From source file:Main.java

public static void main(String[] args) {
    Date date = new Date();

    String strDate = DateFormat.getDateInstance(DateFormat.DEFAULT).format(date);
    System.out.println(strDate);//  w  w w  .  jav  a 2  s  . c  om
}

From source file:DateFormatDemo.java

public static void main(String args[]) {
    Date date = new Date();
    DateFormat df = DateFormat.getDateInstance(DateFormat.LONG);
    System.out.println("Long form: " + df.format(date));

}

From source file:DateFormatDemo.java

public static void main(String args[]) {
    Date date = new Date();
    DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
    System.out.println("Short form: " + df.format(date));

}

From source file:Main.java

public static void main(String[] args) {
    Date date = new Date();
    String strDate = DateFormat.getDateInstance(DateFormat.SHORT).format(date);

    System.out.println(strDate);//from   w  w w.  j  a  v a2 s .  c o m
}

From source file:Main.java

public static void main(String[] args) {
    Date date = new Date();

    String strDate = DateFormat.getDateInstance(DateFormat.MEDIUM).format(date);

    System.out.println(strDate);//from w w  w  .j a v  a2 s . co m
}

From source file:Main.java

public static void main(String[] args) {
    Date date = new Date();

    String strDate = DateFormat.getDateInstance(DateFormat.LONG).format(date);

    System.out.println(strDate);//w w  w  .  j  av  a  2s  .  c o  m
}

From source file:Main.java

public static void main(String[] args) {
    Date date = new Date();

    String strDate = DateFormat.getDateInstance(DateFormat.DEFAULT).format(date);
    System.out.println(strDate);//from w  w w  . j a  v a2  s .c om

    strDate = DateFormat.getDateInstance(DateFormat.FULL).format(date);
    System.out.println(strDate);

    strDate = DateFormat.getDateInstance(DateFormat.LONG).format(date);
    System.out.println(strDate);

    strDate = DateFormat.getDateInstance(DateFormat.SHORT).format(date);
    System.out.println(strDate);
}