build Calendar Instance from int value fields - Android java.util

Android examples for java.util:Calendar

Description

build Calendar Instance from int value fields

Demo Code


//package com.java2s;

import java.util.Calendar;

public class Main {
    public static Calendar buildCalendarInstance(final int year,
            final int month, final int dayOfMonth) {
        final Calendar c = Calendar.getInstance();
        c.clear();/*from   w  w w .ja v  a2  s.  c o m*/

        c.set(Calendar.YEAR, year);
        c.set(Calendar.MONTH, month);
        c.set(Calendar.DAY_OF_MONTH, dayOfMonth);

        return c;
    }
}

Related Tutorials