get Days In Gregorian Month - Android java.util

Android examples for java.util:Month

Description

get Days In Gregorian Month

Demo Code


//package com.java2s;

public class Main {
    private int gregorianYear;
    private int gregorianMonth;
    private int gregorianDate;
    private boolean isGregorianLeap;
    private int dayOfYear;
    private int dayOfWeek;
    private int chineseYear;
    private int chineseMonth;
    private int chineseDate;
    private int sectionalTerm;
    private int principleTerm;
    private static char[] daysInGregorianMonth = { 31, 28, 31, 30, 31, 30,
            31, 31, 30, 31, 30, 31 };//from ww  w  . j  ava2s. c  o  m

    public static char[] getDaysInGregorianMonth() {
        return daysInGregorianMonth;
    }

    public String toString() {
        StringBuffer buf = new StringBuffer();
        buf.append("Gregorian Year: " + gregorianYear + "\n");
        buf.append("Gregorian Month: " + gregorianMonth + "\n");
        buf.append("Gregorian Date: " + gregorianDate + "\n");
        buf.append("Is Leap Year: " + isGregorianLeap + "\n");
        buf.append("Day of Year: " + dayOfYear + "\n");
        buf.append("Day of Week: " + dayOfWeek + "\n");
        buf.append("Chinese Year: " + chineseYear + "\n");
        buf.append("Heavenly Stem: " + ((chineseYear - 1) % 10) + "\n");
        buf.append("Earthly Branch: " + ((chineseYear - 1) % 12) + "\n");
        buf.append("Chinese Month: " + chineseMonth + "\n");
        buf.append("Chinese Date: " + chineseDate + "\n");
        buf.append("Sectional Term: " + sectionalTerm + "\n");
        buf.append("Principle Term: " + principleTerm + "\n");
        return buf.toString();
    }
}

Related Tutorials