Example usage for java.text DateFormatSymbols DateFormatSymbols

List of usage examples for java.text DateFormatSymbols DateFormatSymbols

Introduction

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

Prototype

public DateFormatSymbols() 

Source Link

Document

Construct a DateFormatSymbols object by loading format data from resources for the default java.util.Locale.Category#FORMAT FORMAT locale.

Usage

From source file:OysterMonths.java

public static void main(String[] args) {
    OysterMonths om = new OysterMonths();
    DateFormatSymbols dfs = new DateFormatSymbols();
    String[] monthArray = dfs.getMonths();
    Collection<String> months = Arrays.asList(monthArray);
    om.safeMonths = om.filter(months);//from w  w w  .j a v a  2s . c  o  m
    System.out.println("The following months are safe for oysters:");
    System.out.println(om.safeMonths);
}

From source file:Main.java

public static String[] getWeekDays() {
    return new DateFormatSymbols().getWeekdays();
}

From source file:Main.java

public static String getMonthName(int month) {
    return new DateFormatSymbols().getShortMonths()[month];
}

From source file:Main.java

public static String getMonth(String monthNo) {
    DateFormatSymbols dfs = new DateFormatSymbols();
    String[] months = dfs.getMonths();
    return months[Integer.parseInt(monthNo) - 1];
}

From source file:Main.java

public static String getDayOfTheWeek(int dayOfTheWeek) {
    DateFormatSymbols symbols = new DateFormatSymbols();
    String[] dayNames = symbols.getShortWeekdays();
    return dayNames[dayOfTheWeek];
}

From source file:Main.java

public static String getSubNameOFMonth(int month) {
    DateFormatSymbols dateFormatSymbol = new DateFormatSymbols();
    String monthName = dateFormatSymbol.getShortMonths()[month];
    return monthName;

}

From source file:Main.java

/**
 * Get month name/* w ww  .  j  a v  a  2  s  . c o  m*/
 */
public static String getMonthName(int month) {
    return new DateFormatSymbols().getMonths()[month];
}

From source file:Main.java

public static String getDateForHistory(String dateString) {
    String[] shortMonths = new DateFormatSymbols().getShortMonths();

    SimpleDateFormat parserSDF = new SimpleDateFormat("yyyy-MM-dd");
    SimpleDateFormat formater = new SimpleDateFormat("dd");
    String month = "";

    parserSDF.setTimeZone(TimeZone.getTimeZone("UTC"));
    formater.setTimeZone(TimeZone.getTimeZone("UTC"));
    Date date = null;//  w w w. j  a v  a  2s. co m
    try {
        parserSDF.setTimeZone(TimeZone.getTimeZone("UTC"));
        date = parserSDF.parse(dateString);
        month = shortMonths[date.getMonth()];
    } catch (ParseException e) {
        Log.d(TAG, e.getMessage());
    }

    return month + " " + formater.format(date);
}

From source file:Main.java

/** ExpCalendarUtil.java
 * The number to Week//from w  w w . j  av a 2  s.  c o m
 * @param number - Number day of Week (on the code Sunday is equal 7)
 * @return [String] - abbreviated name of the days of the week
 */
public static String number2Week(int number) {
    if (number < 1 || number > 7)
        return null; //Day of Week 1-7
    if (number == 7) {
        number = 1;
    } else {
        number = number + 1;
    }
    final DateFormatSymbols symbols = new DateFormatSymbols(); //use user locale
    final String nameDayOfWeek = symbols.getShortWeekdays()[number]; //Short name or getWeekdays for complete name
    return nameDayOfWeek.toUpperCase(); //name to uppercase
}

From source file:org.toobsframework.transformpipeline.xslExtentions.DateHelper.java

public static String getMonthStringFromNumber(String monthNumber) {
    int monthInt = -1;
    try {//from   www. j a v a  2  s.  c om
        monthInt = Integer.parseInt(monthNumber);
    } catch (NumberFormatException e) {
        return "";
    }
    if (monthInt < 1 || monthInt > 12) {
        return "";
    }
    DateFormatSymbols dfs = new DateFormatSymbols();
    /*
    String[] month = {"", "January", "February", "March", "April", "May", "June",
      "July", "August", "September", "October", "November", "December"};
    */
    return dfs.getMonths()[monthInt - 1]; //month[monthInt];
}