Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

import java.util.Locale;

public class Main {
    public static String getMonthStringFromDate(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);

        StringBuilder sb = new StringBuilder();
        sb.append(calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.US)).append(", ")
                .append(calendar.get(Calendar.YEAR));

        return sb.toString();
    }
}