code: function getJD(date) {
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var day = date.getDate();
  
    var A = Math.floor(year / 100);
    var B = 2 - A + Math.floor(A / 4);
    var JD = Math.floor(365.25 * (year + 4716)) + Math.floor(30.6001 * (month + 1)) + day + B - 1524.5;
    return JD;
  }
docs: Utility functions for astronomical programming. JavaScript by Peter Hayes http://www.peter-hayes.freeserve.co.uk/ Copyright 2001-2002 This code is made freely available but please keep this notice. I accept no liability for any errors in my coding but please let me know of any errors you find. My address is on my home page.