Java Calendar Create getCalendarOf(int slot)

Here you can find the source of getCalendarOf(int slot)

Description

get Calendar Of

License

Open Source License

Declaration

public static Calendar getCalendarOf(int slot) 

Method Source Code

//package com.java2s;
/**//from ww w .  ja  v a  2 s.  co m
 * This file is part of JEMMA - http://jemma.energy-home.org
 * (C) Copyright 2013 Telecom Italia (http://www.telecomitalia.it)
 *
 * JEMMA is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License (LGPL) version 3
 * or later as published by the Free Software Foundation, which accompanies
 * this distribution and is available at http://www.gnu.org/licenses/lgpl.html
 *
 * JEMMA is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License (LGPL) for more details.
 *
 */

import java.util.Calendar;

public class Main {
    public static final int MINUTES_IN_ONE_TIME_SLOT = 1;

    public static Calendar getCalendarOf(int slot) {
        Calendar c = Calendar.getInstance();
        int minutes = slot * MINUTES_IN_ONE_TIME_SLOT;
        c.set(Calendar.HOUR_OF_DAY, minutes / 60);
        c.set(Calendar.MINUTE, minutes % 60);
        return c;
    }
}

Related

  1. getCalendarFromDates(Date date, Date hourMinuteMillisseconds)
  2. getCalendarFromSystemTimeInMillis(long date)
  3. getCalendarGMT()
  4. getCalendarInstance()
  5. getCalendarInstance()
  6. getCalendarRange(Calendar date, int i)
  7. getCalendarTime(long timestamp)
  8. getCalendarTodayZero(Calendar today)
  9. getCalendarTypeForString(String oneChar)