Java Calendar Time getTime(Calendar c)

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

Description

Return day's year, month(1-12), day(1-31), week(0-6, for SUN, MON, ...

License

Apache License

Declaration

public static int[] getTime(Calendar c) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;

public class Main {
    /**/*from  w  w w  .j av a 2  s . c o m*/
     * Return day's year, month(1-12), day(1-31), week(0-6, for SUN, MON, ... SAT), hour, minute, second.
     */
    public static int[] getTime(long t) {
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(t);
        return getTime(c);
    }

    /**
     * Return day's year, month(1-12), day(1-31), week(0-6, for SUN, MON, ... SAT), hour, minute, second.
     */
    public static int[] getTime(Calendar c) {
        int week = c.get(Calendar.DAY_OF_WEEK) - 1;
        if (week == 0)
            week = 7;
        return new int[] { c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1, c.get(Calendar.DAY_OF_MONTH), week,
                c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), c.get(Calendar.SECOND) };
    }
}

Related

  1. getDateTimeByDate(Date date, int calendarType, int qty)
  2. getFullTimeToString(Calendar argCal)
  3. getLocalTime(Calendar calendar)
  4. getMaxTimeCalendar(Calendar source)
  5. getTime(Calendar c)
  6. getTime(Calendar cal)
  7. getTime(Date date, int CalendarType, int interval)
  8. getTimeFrame(final Calendar calFrom, final Calendar calTo)
  9. getTimeInHHMMSS(Calendar time)