Obtain the Julian day number from a proleptic Julian or Gregorian calendar day and conversely obtain a proleptic Julian or Gregorian calendar day from a Julian day number.


A simple usage example:

import 'package:julian/julian.dart';

main() {
  // What was the Julian day number at the turn of the millennium?
  // prints 2451545
  print('${new Gregorian(2000, 1, 1).julianDayNumber}');

  // On which Gregorian day of July should we celebrate Julius Caesar's
  // birthday?
  // prints 11
  print('${new Julian.fromBC(100, 7, 13).toGregorian().day}');

  // By how many days is the Gregorian calendar further ahead than the
  // Julian calendar in 2016?
  // prints 13
  print('${new Julian(2016, 1, 1).julianDayNumber -
      new Gregorian(2016, 1, 1).julianDayNumber}');

  // On what Gregorian date is the Julian day number equal to zero?
  // prints Gregorian(year: -4713, month: 11, day: 24)
  print('${new Gregorian.fromJulianDayNumber(0)}');

Background reading

Related calendrical Wikipedia articles:



A library for converting between Julian day numbers, proleptic Gregorian calendar days and proleptic Julian calendar days