Example usage for java.text DateFormatSymbols setWeekdays

List of usage examples for java.text DateFormatSymbols setWeekdays

Introduction

In this page you can find the example usage for java.text DateFormatSymbols setWeekdays.

Prototype

public void setWeekdays(String[] newWeekdays) 

Source Link

Document

Sets weekday strings.

Usage

From source file:Main.java

public static void main(String[] args) {
    String[] newMonths = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
    String[] newShortMonths = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov",
            "dec" };
    String[] newWeekdays = { "", "Monday", "Tuesday", "Webnesday", "Thursday", "Friday", "Saturaday",
            "Sunday" };
    String[] shortWeekdays = { "", "monday", "tuesday", "webnesday", "thursday", "friday", "saturaday",
            "sunday" };

    DateFormatSymbols symbols = new DateFormatSymbols();
    symbols.setMonths(newMonths);//  w  ww.j  a  v a 2  s  .  c  o  m
    symbols.setShortMonths(newShortMonths);
    symbols.setWeekdays(newWeekdays);
    symbols.setShortWeekdays(shortWeekdays);

    DateFormat format = new SimpleDateFormat("dd MMMM yyyy", symbols);
    System.out.println(format.format(new Date()));

    format = new SimpleDateFormat("dd MMM yyyy", symbols);
    System.out.println(format.format(new Date()));

    format = new SimpleDateFormat("EEEE, dd MMM yyyy", symbols);
    System.out.println(format.format(new Date()));

    format = new SimpleDateFormat("E, dd MMM yyyy", symbols);
    System.out.println(format.format(new Date()));
}