Esh Esh - 1 year ago 126
Javascript Question

Calculating Jday(Julian Day) in javascript

I have requirement to calculate

in javascript , for doing client side validation , Can any one help me how to calculate
in javascript or script to change given JDAY to actual date or vice versa .

To know what is JDay ,I found the following site ,

Am also refering the below site for calculation which is mentioned in JAVA

Thank you in advance

Answer Source

If what you're looking for is the julian day that would equal 2456141 today, or in other words the number of days since the beginning of the Julian period :

Date.prototype.getJulian = function() {
    return Math.floor((this / 86400000) - (this.getTimezoneOffset()/1440) + 2440587.5);

var today = new Date(); //set any date
var julian = today.getJulian(); //get Julian counterpart 


The day of the year is normally reffered to as a Julian Date, not Day.