Open topic with navigation
A Gregorian date can be converted to a Julian day number (defined as the integer day count since January 1, 4713 BC) in DMExpress by using the DateDiff function and the constant corresponding to the Julian day number on January 1, 1 AD based on the Gregorian calendar.
The attached example demonstrates how to calculate the Julian day number (JDN) for a given Gregorian calendar date (GD) in DMExpress. It involves the following steps:
DateDiff(<date_field>, Day1_GD, 'day') + Day1_JDN
This calculates the day count from Day1_GD (January 1, 1 AD) to the given date, and then adds the previously defined constant, Day1_JDN, for the day count from January 1, 4713 BC to January 1, 1 AD, yielding the Julian day number for the given date.
You can then use the calculated Julian day number value in subsequent processing and/or outputs, such as the target reformat.
Note that there is a distinction between the Julian calendar and the Gregorian calendar when calculating the Julian Day Number. The value we use for the Julian Day Number on January 1, 1 AD, 1721426, is based on the Gregorian calendar. Calculators based on the Julian calendar will give a value of 1721424 for that date.
For details on creating values, see Expressions in the DMExpress help.
For best practices on creating named values, see Named vs. Inline Expressions.
53_Gregorian_Date_to_Julian_Day_Number.zip, compatible with DMExpress version 8.0.5 or higher
Copyright © 2016 Syncsort All rights reserved.