# Introduction to jdcal module

• Last Updated : 24 Oct, 2020

Python has a package for converting Julian calendar to Gregorian calendar called jdcal . It simplifies conversion between both of systems so much that by only a few lines of code are sufficient to reach the functionality.

There are mainly four functions in jdcal:

• gcal2jd : converts Gregorian calendar to Julian date. Takes Year, month and day as integer arguments and returns 2 float tuples.
• jd2gcal : converts Julian date to Gregorian calendar. Takes two integers as arguments and returns four element tuple containing year(int), month(int), day(int) and the fractional part of the day in the Gregorian calendar(float).
• jcal2jd : converts Julian calendar date to Julian date. Takes all integer value as an args array and returns a float tuple.
• jd2jcal : converts Julian calendar date for the given Julian date. Returns tuple of four elements containing year(int), month(int), day(int) and the fractional part of the day in the Julian calendar(float) format.

Installation:

To install, run the following command in your terminal

```pip install jdcal
```

Implementation:

Example 1: (gcal2jd)

## Python3

 `# import module``import` `jdcal as j`` ` `# declare function``a``=` `j.gcal2jd(``2020``, ``12``, ``15``) ``print``(a) `

Output:

(2400000.5, 59198.0)

Example 2 :(jd2gcal)

## Python3

 `# import module``import` `jdcal as j`` ` `# declare function``b``=` `j.jd2gcal(``2400000.5``, ``59198.0``)`` ` `print``(b)`

Output:

(2020, 12, 15, 0.0)

Example 3 :(jcal2jd)

## Python3

 `# import module``import` `jdcal as j`` ` `# declare function``p``=` `j.jcal2jd(``2000``,``2``,``6``)`` ` `print``(p) `

Output:

(2400000.5, 51593.0)

Example 4: (jd2jcal)

## Python3

 `# import module ``import` `jdcal as j`` ` `# declare function``l``=``j.jd2jcal(``2400000.5``, ``51593.0``)`` ` `print``(l)`

Output:

(2000, 2, 6, 0.0)

My Personal Notes arrow_drop_up