Java Calendar Second getSecondsSinceMidnight(Calendar c)

Here you can find the source of getSecondsSinceMidnight(Calendar c)

Description

get Seconds Since Midnight

License

Open Source License

Declaration

public static int getSecondsSinceMidnight(Calendar c) 

Method Source Code

//package com.java2s;
/**//from w ww .j a v a2 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 int getSecondsSinceMidnight(Calendar c) {
        return 3600 * c.get(Calendar.HOUR_OF_DAY) + 60 * c.get(Calendar.MINUTE) + c.get(Calendar.SECOND);
    }
}

Related

  1. after(final Calendar first, final Calendar second)
  2. clearCalendarSecondWithRear(Calendar cal)
  3. dateEquals(Calendar calendarFirst, Calendar calendarSecond)
  4. getSecond(Calendar calendar)
  5. getSecondsSinceMidnight(final Calendar time)
  6. getTimeInSeconds(Calendar t)
  7. getTimeSeconds(Calendar cal)
  8. getTimestampInDayFirstSecond(final Calendar calendar)