Java Day of ToEnglishDayWithMon(Date dt)

Here you can find the source of ToEnglishDayWithMon(Date dt)

Description

To English Day With Mon

License

Open Source License

Declaration

public static String ToEnglishDayWithMon(Date dt) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {
    private static final String[] MONTHS = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
            "Nov", "Dec" };
    private static final String[] WEEK_DAYS = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
            "Saturday" };

    public static String ToEnglishDayWithMon(Date dt) {
        if (dt == null)
            return "";
        DateFormatSymbols sym = new DateFormatSymbols();
        sym.setMonths(MONTHS);//from  www .  j  av a 2  s.co m
        SimpleDateFormat f = new SimpleDateFormat("dd MMM, yyyy", sym);

        return getWeekDay(dt) + ", " + f.format(dt);
    }

    private static String getWeekDay(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        int idx = cal.get(Calendar.DAY_OF_WEEK) - 1;
        return WEEK_DAYS[idx];
    }
}

Related

  1. stringSomeDaysAgo(Date currentTime, int days)
  2. strToShortday(String s)
  3. subtractDate(Date d, long day)
  4. toCurrentDatedefer(int day)
  5. ToEnglishDay(Date dt)
  6. tomorrow(int dayafter)
  7. toNextDayYMD()
  8. toUtcDay(Date d)
  9. truncateToBeginOfDay(Date date)