Example usage for java.text DateFormat MEDIUM

List of usage examples for java.text DateFormat MEDIUM

Introduction

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

Prototype

int MEDIUM

To view the source code for java.text DateFormat MEDIUM.

Click Source Link

Document

Constant for medium style pattern.

Usage

From source file:Main.java

public static void main(String args[]) {
    int style = DateFormat.MEDIUM;
    // Also try with style = DateFormat.FULL and DateFormat.SHORT
    Date date = new Date();
    DateFormat df;//from  w  ww.  j a  va 2s . c  om
    df = DateFormat.getDateInstance(style, Locale.UK);
    System.out.println("United Kingdom: " + df.format(date));
    df = DateFormat.getDateInstance(style, Locale.US);
    System.out.println("USA: " + df.format(date));
    df = DateFormat.getDateInstance(style, Locale.FRANCE);
    System.out.println("France: " + df.format(date));
    df = DateFormat.getDateInstance(style, Locale.ITALY);
    System.out.println("Italy: " + df.format(date));
    df = DateFormat.getDateInstance(style, Locale.JAPAN);
    System.out.println("Japan: " + df.format(date));
}

From source file:ShowDate.java

public static void main(String[] args) {
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, Locale.CANADA_FRENCH);
    System.out.println(df.format(new Date()));
}

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 {

    Date date = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.CANADA).parse("29 janv. 2002");
}

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);//  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.MEDIUM).format(date);

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

From source file:CalendarManipulation.java

public static void main(String s[]) {
    Calendar cal = Calendar.getInstance();
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.MEDIUM);

    System.out.println(df.format(cal.getTime()));
}

From source file:CalendarManipulation.java

public static void main(String s[]) {
    Calendar cal = Calendar.getInstance();
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.MEDIUM);

    System.out.println(df.format(cal.getTime()));

    cal.add(Calendar.DATE, 8);//from ww w  .  j ava  2  s . c om
    System.out.println(df.format(cal.getTime()));
}

From source file:CalendarManipulation.java

public static void main(String s[]) {
    Calendar cal = Calendar.getInstance();
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.MEDIUM);

    System.out.println(df.format(cal.getTime()));

    cal.add(Calendar.HOUR, -4);// w w w.  ja  va  2 s . c  o m
    System.out.println(df.format(cal.getTime()));
}

From source file:CalendarManipulation.java

public static void main(String s[]) {
    Calendar cal = Calendar.getInstance();
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.MEDIUM);

    System.out.println(df.format(cal.getTime()));

    cal.add(Calendar.AM_PM, 1);//from  www  .  j a va  2 s .c  o  m
    System.out.println(df.format(cal.getTime()));
}