Menu
Hi ALL!
I need javascript calendar with regular and julian dates on it, urgent!
Please help.
Something like on this image:
Thank you in advance.
[upl-file uuid=8d19f42a-0fac-4d36-b600-c2bbba096437 size=4kB]Julian date.gif
<i>
</i>Date.prototype.julianDate=function(){
var j=parseInt((this.getTime()-new Date('Dec 30,'+(this.getFullYear()-1)+' 23:00:00').getTime())/86400000).toString(),
i=3-j.length;
while(i-->0)j=0+j;
return j
};
alert(new Date().julianDate())
<i>
</i>Function vb_julianDate(date_str)
vb_julianDate = DatePart("y",DateValue(date_str))
End Function
<i>
</i>Date.prototype.month=function(){
return ['January','February','March','April','May','June','July','August','September','October','November','December'][this.getMonth()]
};
Date.prototype.vbDate=function(){
return this.month()+' '+this.getDate()+','+this.getFullYear()
};
var julian_date=vb_julianDate(new Date().vbDate())
[code=php]<script type="text/javascript">
now = new Date;
alert((now.valueOf()/86400000) + 2440587.5);
</script>[/code]
<i>
</i>var today = new Date();
var julday = math.Floor((today.valueOf() / (1000 * 60 * 60 * 24)) - 0.5) + 2440588;
You are getting Julian DAY and Julian DATE mixed up.
Julian DAY == The interval of time in days since noon at Greenwich on 1 January 4713 BC
Julian DATE == The day number within the year counting January 1st as 1 and December 31st as 365 (or 366 in leap years).
To calculate the Julian DAY
[/QUOTE]
<i>
</i>var today = new Date();
var julday = math.Floor((today.valueOf() / (1000 * 60 * 60 * 24)) - 0.5) + 2440588;
I don't know what that is above but it certainly has nothing to do with the julian date.
Julian date == The interval of time in days since noon at Greenwich on 1 January 4713 BC
[code=php]<script type="text/javascript">
[/QUOTE]
now = new Date;
alert((now.valueOf()/86400000) + 2440587.5);
</script>[/code]
2 gph :
Its exactly what I need on your attached image file! Where I can get that MS calendar?
Will it work for web plain html file?[/QUOTE]
Julian date, atleast in practical application, means the 3 digit numeric day of the year.[/QUOTE]
Open the hood of a car and look for numbers on the parts, in those numbers will be a 3 digit julian date and a 2 digit year number. This is so car manufacturers and suppliers can trace batches of parts.[/QUOTE]
If you search the key term[url=http://www.google.ca/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=%22julian+date%22+industry&btnG=Search]another google search[/url] [/QUOTE]
If you search the key term[URL=http://www.google.ca/search?hs=fgV&hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=%22julian+date%22+&btnG=Search&meta=]Julian date[/URL] you won't see that errornous use. You will instead find 675,000 pages with the correct use.[/QUOTE]
There are millions of offline references that define the Julian Date as the day number within a given year. That wikipedia and google results show differently just demonstrates that there are a lot of people who don't know the difference.[/QUOTE]So which source would you accept?
So which source would you accept?
Encyclopaedia Britanica?
Encarta?
Sky and Telescope?
Are they all wrong as well?[/QUOTE]
[CODE]Date.prototype.toJulian= function(fixed){
var D= this.toUTCArray(), F= Math.floor;
var year= D[0], month= D[1]+1, date= D[2],
hr= D[3], min= D[4], sec= D[5];
var a= Math.abs(month-9), g= 1, jd, j1, v= 1;
if(year<= 1585) g= 0;
if((month-9)< 0) v= -1;
hr= hr+(min/60)+ (sec/3600);
j1= -1*F((F((F(year+v*F(a/7)))/100)+ 1)*3/4);
jd= -1*F(7*(F((month+9)/12)+ year)/4);
jd= jd+F(275*month/9)+date+(g*j1);
jd=( jd+1721027+2*g+367*year-.5)+(hr/24);
if(typeof fixed== 'number') return jd.toFixed(fixed);
return fixed===true? jd: F(jd);
}
Date.prototype.toUTCArray= function(){
var D= this;
return [D.getUTCFullYear(), D.getUTCMonth(),
D.getUTCDate(), D.getUTCHours(),D.getUTCMinutes(),
D.getUTCSeconds(), D.getUTCMilliseconds()];
}[/CODE]
[CODE]Date.prototype.getDayofYear= function(){
var d= new Date(this).setMonth(0, 0);
return Math.round((this-d)/86400000);
}[/CODE]
[B]Yes if they don't mention the most common value that people mean when they refer to Julian Date - which is CCYYDDD (so today is 2009174).I can't believe it took you 4 years to come up with that.
The Julian day is of course 2455006.[/QUOTE]
0.1.9 — BETA 5.8