Example usage for java.util Formatter Formatter

List of usage examples for java.util Formatter Formatter

Introduction

In this page you can find the example usage for java.util Formatter Formatter.

Prototype

public Formatter() 

Source Link

Document

Constructs a new formatter.

Usage

From source file:MainClass.java

public static void main(String args[]) {
    Formatter fmt = new Formatter();
    Calendar cal = Calendar.getInstance();

    // .// w  w  w  .ja va 2 s .c o m
    fmt = new Formatter();
    fmt.format("%tl:%tM", cal, cal);
    System.out.println(fmt);
}

From source file:MainClass.java

public static void main(String args[]) {
    Formatter fmt = new Formatter();

    // ./*from   ww w  .  j  a v a2s.c  o  m*/
    fmt = new Formatter();
    fmt.format("%tc", Calendar.getInstance());
    System.out.println(fmt);

}

From source file:MainClass.java

public static void main(String args[]) {
    Formatter fmt = new Formatter();
    Calendar cal = Calendar.getInstance();

    fmt = new Formatter();
    fmt.format("%tc", cal);
    System.out.println(fmt);//from w w w . ja  va  2 s. com

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Formatter fmt = new Formatter();
    Calendar cal = Calendar.getInstance();
    System.out.println(fmt.format("Short date format: %tD\n", cal));
}

From source file:FormatDemo4.java

public static void main(String args[]) {
    Formatter fmt = new Formatter();

    fmt.format("|%f|%n|%12f|%n|%012f|", 10.12345, 10.12345, 10.12345);

    System.out.println(fmt);//w  w w. j a v  a  2s.  co  m

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Formatter fmt = new Formatter();
    Calendar cal = Calendar.getInstance();
    fmt.format("Hour and Minute: %tl:%1$tM %1$Tp\n", cal);
    // Display the formatted times and dates.
    System.out.println(fmt);/*from w ww .  j a v a  2 s. c  o m*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Formatter fmt = new Formatter();
    Calendar cal = Calendar.getInstance();

    fmt.format("Time using 24-hour clock: %tT\n", cal);
    System.out.println(fmt);/*  w ww  .  jav  a  2 s.c  o m*/

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Formatter fmt = new Formatter();
    Calendar cal = Calendar.getInstance();

    fmt.format("Time using 12-hour clock: %tr\n", cal);
    System.out.println(fmt);/*from   w ww .ja  v a 2s.c o  m*/

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Formatter fmt = new Formatter();
    Calendar cal = Calendar.getInstance();

    fmt.format("Long date format: ");
    fmt.format("%tA %1$tB %1$td, %1$tY\n", cal);
    System.out.println(fmt);/* ww  w. ja v  a 2s  .  c  o m*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Formatter fmt = new Formatter();
    Calendar cal = Calendar.getInstance();

    // Display 12-hour time format.
    fmt.format("Time using 12-hour clock: %tr\n", cal);
    System.out.println(fmt);/*from   w  ww .j a  va2  s .c o  m*/

}