Open In App

Introduction to jdcal module

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:



Installation:  

To install, run the following command in your terminal 



pip install jdcal

Implementation:

Example 1: (gcal2jd)




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

Output:

(2400000.5, 59198.0)

Example 2 :(jd2gcal)




# 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)




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

Output:

(2400000.5, 51593.0)

Example 4: (jd2jcal)




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

Output:

(2000, 2, 6, 0.0)


Article Tags :