julian 0.1.2 julian: ^0.1.2 copied to clipboard
Convert between Julian day numbers, proleptic Julian calendar days and proleptic Gregorian calendar days.
julian #
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.
Usage #
A simple usage example:
import 'package:julian/julian.dart';
main() {
// 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)}');
// 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 Julian calendar ahead of the Gregorian calendar
// in 2016?
// prints 13
print('${new Julian(2016, 1, 1).julianDayNumber -
new Gregorian(2016, 1, 1).julianDayNumber}');
}
Background reading #
Related calendrical Wikipedia articles: