Android Calendar Set prepareCalendar(int hourOfDay, int minute)

Here you can find the source of prepareCalendar(int hourOfDay, int minute)

Description

prepare Calendar

Declaration

private static Calendar prepareCalendar(int hourOfDay, int minute) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

public class Main {
    private static Calendar prepareCalendar(int hourOfDay, int minute) {
        Calendar calNow = Calendar.getInstance();
        Calendar calSet = (Calendar) calNow.clone();

        calSet.set(Calendar.HOUR_OF_DAY, hourOfDay);
        calSet.set(Calendar.MINUTE, minute);
        calSet.set(Calendar.SECOND, 0);
        calSet.set(Calendar.MILLISECOND, 0);

        if (calSet.compareTo(calNow) <= 0) {
            // Today Set time passed, count to tomorrow
            calSet.add(Calendar.DATE, 1);
        }//w w w .j av a2 s .  c  o m
        return calSet;
    }
}

Related

  1. setTo2359(Calendar c)
  2. setToDec31(Calendar c)
  3. modify(Calendar val, int field, boolean round)
  4. toDateTime(Calendar calendar)
  5. stripTime(Calendar cal)
  6. setDate(Calendar cal, long date)
  7. setTime(Calendar cal, long time)