Here you can find the source of getTime(Calendar c)
public static int[] getTime(Calendar c)
//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) }; } }