Here you can find the source of getGregorianDay(Calendar cal)
public static int getGregorianDay(Calendar cal)
//package com.java2s; /**//w w w.j a v a2 s . co m * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library 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 for more * details. */ import java.util.Calendar; public class Main { public static int getGregorianDay(Calendar cal) { int year = cal.get(Calendar.YEAR) - 1600; int month = cal.get(Calendar.MONTH) + 1; if (month < 3) { month += 12; } int day = cal.get(Calendar.DATE); int gregorianDay = (int) (6286 + (year * 365.25) - (year / 100) + (year / 400) + (30.6 * month) + 0.2 + day); return gregorianDay; } }