DISCOVER
×

How to Convert a Gregorian Calendar Date to a Julian Calendar Date Using SQL

Updated July 20, 2017

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 "" with any Gregorian-formatted date:

SELECT DATEDIFF(dd, 0, ) + 2415021

Convert a Julian date to Gregorian by executing the following query statement, replacing "" with any Julian-formatted date:

SELECT DATEADD(dd, - 2415021, 0)

Cite this Article A tool to create a citation to reference this article Cite this Article

About the Author

Brendan Mason has over 10 years experience in database-driven software development, database administration and network administration. He is also an accomplished angler who specializes in fly fishing for saltwater gamefish. Mason's writing and photography have been published in "Fish & Fly" magazine, "The Drake" magazine, "Yale Anglers' Journal" and more.