I see. No problem.

Perhaps you can help fix with this other one that i almost have working.

7 days = 1 week

7 weeks = 1 month

7 months = 1 year (343 days)

the 8th year is 7 months of 21 days

the 9th year is 9 days

After the 9th year it gets cycled into a new cycle where the years start to recount

This cycle system lines up so that at the end of the 28th year in the julian system ends on the same day as the 4th cycle of this system with 10227 days.

the current problem i'm having is that 2401 days should be the last day of the 7th year... It is returning a year 8 day 0

edit - I found the same problem in my julien calender code... The last day of every year is zero'd out.

this is what i have... yeah i know my naming conventionbs are sloppy v.v

edit again...Code:`function DrCal(days) {`

drCycle = 2557

drYeara = 343

drYearb = 147

//drYearc = 9

Cycle = Math.floor(days/drCycle)

DaysNotOfCycle = Cycle * drCycle

DaysOfCycle = days - DaysNotOfCycle

var drMonth=new Array("m1","m2","m3","m4","m5","m6","m7")

var drMonthEnd=new Array("49","98","147","196","245","294","343")

var drMonthb=new Array("m1","m2","m3","m4","m5","m6","m7")

var drMonthbEnd=new Array("21","42","63","84","105","126","147")

if(DaysOfCycle <= 2401) {

drYear = Math.floor(DaysOfCycle / drYeara)

DaysNotOfYear = drYear*drYeara // causing problem

drYear++

DaysOfYear = DaysOfCycle - DaysNotOfYear //causing problem

theMonth = 0

for (m = 0; m < 7; m++) {

if(DaysOfYear <= drMonthEnd[m]) {

theMonth = m;

break;}

}

Month = drMonth[theMonth]

if(theMonth > 0) {

drDate = DaysOfYear - drMonthEnd[theMonth-1]

}else{

drDate = DaysOfYear

}

} else if ((DaysOfCycle > 2401) && (DaysOfCycle <= 2548)) {

drYear = 8

DaysOfYear = DaysOfCycle - (drYeara*7)

theMonth = 0

for (m = 0; m < 7; m++) {

if(DaysOfYear <= drMonthbEnd[m]) {

theMonth = m;

break;}

}

Month = drMonthb[theMonth]

if(theMonth > 0) {

drDate = DaysOfYear - drMonthbEnd[theMonth-1]

}else{

drDate = DaysOfYear

}

}else{

drYear = 9

drDate = DaysOfCycle - (drYeara+drYearb)

Month = 1

}

Cycle++

document.write("<br />Dr Cycle: " +Cycle+ " Year:" +drYear+ " Month:" +Month+ " " +drDate)

}

I have figured a solution to my problem. I switched to your code, Pedant, and add 3 changes... 1 non-important, 1 I moved the function to a subfunction so i can call another date system, and I corrected one minor little problem

This makes the date start at year 1 rather than year 0Code:`var yrs = (4 * quads) +1;`

Everything else as far as I have tested works great and I am using the way you coded this one to try to code the other one i mentioned...

here's the code so far

I think for the years i'm going to use a the month code as it should be more or less the sameCode:`var nDays = Number( document.getElementById("days").value );`

var Cycle = Math.floor(nDays / 2557);

if(nDays%2557 != 0)

{

nDays -= Cycle*2557;

Cycle++;

}

/* var mnames = ["Jan","Feb","Mar","Apr","May","Jun",

"Jul","Aug","Sep","Oct","Nov","Dec" ];

var mDays = [ 31,28,31,30,31,30,31,31,30,31,30,31 ];

// handle leap year:

mDays[1] = ( yrs % 4 == 0 ) ? 29 : 28;

var theMonth = -1;

for ( var m = 0; m < 12; ++m )

{

if ( nDays <= mDays[m] )

{

theMonth = m;

break; // out of for loop

}

nDays -= mDays[m];

}

var monthName = mnames[theMonth];

*/

document.getElementById("jDate").innerHTML =

"Cycle: " +Cycle+ " Days: " +nDays;

I do however have a question... when I merge these two together, will the var names cause a problem. I forget how var localization in JS works.