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

Written by brendan mason
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Convert a Gregorian Calendar Date to a Julian Calendar Date Using SQL
Standard calendars use the Gregorian date format. (Hemera Technologies/AbleStock.com/Getty Images)

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.

Skill level:
Easy

Other People Are Reading

Instructions

  1. 1

    Open SQL Server Management Studio.

  2. 2

    Open a new query window.

  3. 3

    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

  4. 4

    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)

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.