Example usage for java.text DateFormat format

List of usage examples for java.text DateFormat format

Introduction

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

Prototype

public final String format(Date date) 

Source Link

Document

Formats a Date into a date-time string.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getInstance();

    String s = dateFormat.format(new Date());
    System.out.println(s);/*  w w  w .j  a v a  2 s  . c  o m*/

}

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);//from   ww  w.ja  v  a2  s .  com

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getTimeInstance();

    String s = dateFormat.format(new Date());
    System.out.println(s);/*from   www .j a va  2  s .c  o  m*/

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getDateTimeInstance();

    String s = dateFormat.format(new Date());
    System.out.println(dateFormat.isLenient());

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getDateTimeInstance();

    String s = dateFormat.format(new Date());
    System.out.println(dateFormat.getTimeZone());

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getDateTimeInstance();

    String s = dateFormat.format(new Date());
    System.out.println(s);/*from  w ww .  ja v a2s .c o m*/

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getDateTimeInstance();

    String s = dateFormat.format(new Date());
    System.out.println(dateFormat.getCalendar());

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getDateTimeInstance();

    String s = dateFormat.format(new Date());
    System.out.println(dateFormat.hashCode());

}

From source file:Main.java

public static void main(String[] args) {
    Date date = Calendar.getInstance().getTime();

    // Display a date in day, month, year format
    DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
    String today = formatter.format(date);
    System.out.println("Today : " + today);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.LONG);

    String s = dateFormat.format(new Date());
    System.out.println(dateFormat.getNumberFormat().getMinimumFractionDigits());

}