function d2g(jdn) {
		var j, i, gd, gm, gy;
		j = 4 * jdn + 139361631;
		j = j + div(div(4 * jdn + 183187720, 146097) * 3, 4) * 4 - 3908;
		i = div(mod(j, 1461), 4) * 5 + 308;
		gd = div(mod(i, 153), 5) + 1;
		gm = mod(div(i, 153), 12) + 1;
		gy = div(j, 1461) - 100100 + div(8 - gm, 6);
		return	{
			year: gy,
			month: gm - 1,
			day: gd
		};
	}
function d2g(jdn) {
		var j, i, gd, gm, gy;
		j = 4 * jdn + 139361631;
		j = j + div(div(4 * jdn + 183187720, 146097) * 3, 4) * 4 - 3908;
		i = div(mod(j, 1461), 4) * 5 + 308;
		gd = div(mod(i, 153), 5) + 1;
		gm = mod(div(i, 153), 12) + 1;
		gy = div(j, 1461) - 100100 + div(8 - gm, 6);
		return	{
			year: gy,
			month: gm - 1,
			day: gd
		};
	}
function d2g ( jdn ) { var j , i , gd , gm , gy ; j = 4 * jdn + 139361631 ; j = j + div ( div ( 4 * jdn + 183187720 , 146097 ) * 3 , 4 ) * 4 - 3908 ; i = div ( mod ( j , 1461 ) , 4 ) * 5 + 308 ; gd = div ( mod ( i , 153 ) , 5 ) + 1 ; gm = mod ( div ( i , 153 ) , 12 ) + 1 ; gy = div ( j , 1461 ) - 100100 + div ( 8 - gm , 6 ) ; return { year : gy , month : gm - 1 , day : gd } ; }
/*
Calculates Gregorian and Julian calendar dates from the Julian Day number
(jdn) for the period since jdn=-34839655 (i.e. the year -100100 of both
calendars) to some millions years ahead of the present.
@param jdn Julian Day number
@return
gy: Calendar year (years BC numbered 0, -1, -2, ...)
gm: Calendar month (1 to 12)
gd: Calendar day of the month M (1 to 28/29/30/31)
/ * Calculates Gregorian and Julian calendar dates from the Julian Day number ( jdn ) for the period since jdn = - 34839655 ( i . e . the year - 100100 of both calendars ) to some millions years ahead of the present .
Convert jdn to g