Java Calendar Time getTimeValue(Calendar cal)

Here you can find the source of getTimeValue(Calendar cal)

Description

Returns a number based on the date and time of the specified Calendar object.

License

Open Source License

Parameter

Parameter Description
cal The calendar object or null to get a number based on the current time.

Return

A comparable numeric value derived from the calendar object (higher = newer).

Declaration

public static long getTimeValue(Calendar cal) 

Method Source Code

//package com.java2s;
// See LICENSE.txt for license information

import java.util.Calendar;

public class Main {
    /**/*from ww  w.ja  va  2 s.c om*/
     * Returns a number based on the date and time of the specified Calendar object.
     * @param cal The calendar object or {@code null} to get a number based on the current time.
     * @return A comparable numeric value derived from the calendar object (higher = newer).
     */
    public static long getTimeValue(Calendar cal) {
        if (cal == null) {
            cal = Calendar.getInstance();
        }

        return cal.getTimeInMillis();
    }
}

Related

  1. getTime(Date date, int CalendarType, int interval)
  2. getTimeFrame(final Calendar calFrom, final Calendar calTo)
  3. getTimeInHHMMSS(Calendar time)
  4. getTimeStr(Calendar cal)
  5. getTimeToString(Calendar argCal)
  6. getTimeYYYYMMDD(Calendar calendar)
  7. getTimeZone(Calendar cal)
  8. getTimeZoneCalendar(final TimeZone timeZone)
  9. getTimezoneString(Calendar cal)