Android Long to Date Convert getMinutesSinceStartOfDay(long milliseconds)

Here you can find the source of getMinutesSinceStartOfDay(long milliseconds)

Description

get Minutes Since Start Of Day

Declaration

public static int getMinutesSinceStartOfDay(long milliseconds) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

public class Main {
    public static int getMinutesSinceStartOfDay() {
        Calendar c = Calendar.getInstance();
        int hours = c.get(Calendar.HOUR);
        int ampm = c.get(Calendar.AM_PM);

        if (ampm == Calendar.PM) {
            hours += 12;// w w w .j  ava2 s. c o m
        }

        int minutes = c.get(Calendar.MINUTE);

        return hours * 60 + minutes;
    }

    public static int getMinutesSinceStartOfDay(long milliseconds) {
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(milliseconds);

        int hours = c.get(Calendar.HOUR);
        int ampm = c.get(Calendar.AM_PM);

        if (ampm == Calendar.PM) {
            hours += 12;
        }

        int minutes = c.get(Calendar.MINUTE);

        return hours * 60 + minutes;
    }
}

Related

  1. getHour(long timeMillis)
  2. getHoursAndMinutes(long dateTimeMillis)
  3. getLocalTimeFromUTCMillis(long utcMillis)
  4. getLongOfString(String date)
  5. getMinute(long dateTimeMillis)
  6. getMonth(long dateTimeMillis)
  7. getNameForDcim(long time)
  8. getNameForFile(long time)
  9. getNumberOfDaysPassed(long date1, long date2)