Java Minute Get getMinute(long time)

Here you can find the source of getMinute(long time)

Description

Gets the minute.

License

Open Source License

Parameter

Parameter Description
time the time

Return

the minute

Declaration

public static int getMinute(long time) 

Method Source Code

//package com.java2s;
/***/*w  w w  .j  a va 2s  . co  m*/
 * Mages: Multiplayer Game Engine for mobile devices
 * Copyright (C) 2008 aksonov
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 * 
 * This library 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 for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * 
 * Contact: aksonov dot gmail dot com
 *
 * Author: Pavlo Aksonov
 */

public class Main {
    /**
     * Gets the minute.
     * 
     * @param time the time
     * 
     * @return the minute
     */
    public static int getMinute(long time) {
        return (int) ((time - getTime(getHour(time), 0)) / (60 * 1000));
    }

    /**
     * Gets the time.
     * 
     * @param hour the hour
     * @param minute the minute
     * 
     * @return the time
     */
    public static int getTime(int hour, int minute) {
        return getTime(hour, minute, 0);
    }

    /**
     * Gets the time.
     * 
     * @param hour the hour
     * @param minute the minute
     * @param second the second
     * 
     * @return the time
     */
    public static int getTime(int hour, int minute, int second) {
        return (hour * 60 * 60 + minute * 60 + second) * 1000;
    }

    /**
     * Gets the hour.
     * 
     * @param time the time
     * 
     * @return the hour
     */
    public static int getHour(long time) {
        return (int) (time / (60 * 60 * 1000));
    }
}

Related

  1. getMinute(Date date)
  2. getMinute(Date date)
  3. getMinute(Date date)
  4. getMinute(Date date1, Date date2)
  5. getMinute(long mills)
  6. getMinute(String time)
  7. getMinuteAfter(Date date, int minute)
  8. getMinuteAsInt(String hourString)
  9. getMinuteCa(Date d1, Date d2)