toJulianDate

Return the Date as Number (Julian Date). Without Time.

let n = Date.toJulianDate(String Type);

 

Julian day is the continuous count of days since the beginning of the Julian Period and is used primarily by astronomers, and in software for easily calculating elapsed days between two events (e.g. food production date and sell by date)

 

The Julian Day Number (JDN) is the integer assigned to a whole solar day in the Julian day count starting from noon Universal time, with Julian day number 0 assigned to the day starting at noon on Monday, January 1, 4713 BC, proleptic Julian calendar (November 24, 4714 BC, in the proleptic Gregorian calendar),

This  a date at which three multi-year cycles started (which are: Indiction, Solar, and Lunar cycles) and which preceded any dates in recorded history.

 

This function support different 0-Points and ignore time.

In software - special in ERP You can use this for Batch number generation

 

The Modified Julian Date Date.toJulianDate("MD") is created for Software. This reduce the big number and it's more simple to use.

 

Type

Description

0 - date

BC (or empty)

Julian Date

Note: The system calculate from  01/01/2000 and return this result + 2 451 545

Time ignored.

-4712/01/01

MJD

Modified Julian Date (Time scale from Smithsonian Institution)

1858/11/17

Python

Python calculation

2000/1/1

COBOL

COBOL calculation DAY-OF-INTEGER

1600/12/31

MS

Microsoft Windows

1601/01/01

LibreOffice

Libre Office calculation

1899/12/30

MS-Excel

Microsoft Excel calculation

1899/12/30

Unix

Unix Calculation

1970/01/01

Java

Java Calculation

1970/01/01

JavaScript

JavaScript Calculation

1970/01/01

C++

C++ Calculation

1970/01/01

 

Calculation:

if Month > 2 
      Y = Year;    M = Month
  else
      Y = Year -1 ; M = Month+12
  D = Day 
 
if (Julian Calendar)
      B = 0
else if (gregorian Calendar)
      B = 2 -  (Y/100)  +  (Y/400) 
  
JD =  365.25 * (Y + 4716)  +  30.6001 * (M + 1)   + D + B - 1524.5

 

Source: Wikipedia