Java Date Convert dateToEnglishString(java.util.Date date)

Here you can find the source of dateToEnglishString(java.util.Date date)

Description

date To English String

License

Apache License

Declaration

static public String dateToEnglishString(java.util.Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;

public class Main {
    static public String dateToEnglishString(java.util.Date date) {
        return dateToEnglishString(date, true, '-', '-');
    }//  ww  w .jav  a2s. c  om

    static public String dateToEnglishString(java.util.Date date, boolean shortMonth, char deliMD, char deliDY) {
        if (date == null)
            return null;
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        int m = calendar.get(Calendar.MONTH);
        String month;
        if (shortMonth)
            month = "JanFebMarAprMayJunJulAugSepOctNovDec".substring(m * 3, m * 3 + 3);
        else {
            String emonth[] = new String[] { "January", "February", "March", "April", "May", "June", "July",
                    "August", "September", "October", "November", "December" };
            month = emonth[m];
        }
        return month + deliMD + calendar.get(Calendar.DATE) + deliDY + calendar.get(Calendar.YEAR);
    }
}

Related

  1. convertToDateTime(String source)
  2. convertToStartOfDay(Date date)
  3. convertTweetDateToLong(String date)
  4. convertZeroHourDate(Date source)
  5. dateToCal(Date date)
  6. dateToFMDate(Date date)
  7. dateToInt(Date date)
  8. dateToISOXDSb(Date date)
  9. dateToJulian(Date date)