Example usage for java.text DateFormat getTimeInstance

List of usage examples for java.text DateFormat getTimeInstance

Introduction

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

Prototype

public static final DateFormat getTimeInstance(int style, Locale aLocale) 

Source Link

Document

Gets the time formatter with the given formatting style for the given locale.

Usage

From source file:Main.java

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

    Date date = DateFormat.getTimeInstance(DateFormat.MEDIUM, Locale.CANADA).parse("21:44:07");
}

From source file:Main.java

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

    String s = DateFormat.getTimeInstance(DateFormat.MEDIUM, Locale.CANADA).format(new Date());
    System.out.println(s);//from ww w  .j  a  va2s  .  com
}

From source file:Main.java

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

    Date date = DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.CANADA).parse("21.33.03");
    System.out.println(date);//from  w  w  w  .  j a v a 2  s  . co m
}

From source file:Main.java

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

    String s = DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.CANADA).format(new Date());
    System.out.println(s);/*ww w  .  j  av a  2 s . com*/

}

From source file:Main.java

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

    String s = DateFormat.getTimeInstance(DateFormat.LONG, Locale.CANADA).format(new Date());
    System.out.println(s);/*from ww w  .j  a  va  2s  . c  o m*/

}

From source file:Main.java

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

    String s = DateFormat.getTimeInstance(DateFormat.FULL, Locale.CANADA).format(new Date());
    System.out.println(s);/*ww w . ja v a 2 s  . c  o m*/

}

From source file:TimeFormatDemo.java

public static void main(String args[]) {
    Date date = new Date();
    DateFormat df;//www  .j a  va2 s  .  com

    df = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.JAPAN);
    System.out.println("Japan: " + df.format(date));

    df = DateFormat.getTimeInstance(DateFormat.LONG, Locale.UK);
    System.out.println("United Kingdom: " + df.format(date));

    df = DateFormat.getTimeInstance(DateFormat.FULL, Locale.CANADA);
    System.out.println("Canada: " + df.format(date));
}

From source file:Main.java

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

    Locale locale = Locale.ITALIAN;
    Date date = new Date();

    String s = DateFormat.getTimeInstance(DateFormat.SHORT, locale).format(date);
    System.out.println(s);// w w  w.  j a  v  a  2s  .  c om
}

From source file:Main.java

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

    Locale locale = Locale.ITALIAN;
    Date date = new Date();

    DateFormat df = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale);

    String s = df.format(date);/*  w  w w .  ja  v  a 2  s.c  o  m*/
    System.out.println(s);
}

From source file:Main.java

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

    Locale locale = Locale.ITALIAN;
    Date date = new Date();

    DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT, locale);

    String s = df.format(date);//from   w w  w  . j av a 2 s.  com
    System.out.println(s);
}