The Gregorian calendar is the internationally accepted standard calendar of the six principal calendars currently in use throughout the world. The Julian calendar is the only other solar-based calendar and is often used for astronomical and scientific applications. These calendars use very different formats, but it is actually quite simple to convert from one format to the other using Transact-SQL with the built-in DATEDIFF() and DATEADD() functions.
Open SQL Server Management Studio.
Open a new query window.
Convert a Gregorian date to Julian by executing the following query statement, replacing "<GregorianDate>" with any Gregorian-formatted date:
SELECT DATEDIFF(dd, 0, <GregorianDate>) + 2415021
Convert a Julian date to Gregorian by executing the following query statement, replacing "<JulianDate>" with any Julian-formatted date:
SELECT DATEADD(dd, <JulianDate> - 2415021, 0)