Skip to content

Quick-tip 16 | Convert a date in EL Julian Date format to a DateTime object

The EasyLanguage DateTime Julian date format is a double precision number equal to a whole number representing the number of days since January 1, 1900 and a decimal part as a fraction of the day since midnight. This double DateTime is not to be confused with EasyLanguage’s DateTime object.

We can use GetAppInfo( aiRightDispDateTime ) to find the DateTime of the right  of the chart, or GetAppInfo( aiLeftDispDateTime ) to find the DateTime value of left of the chart.

If we are using TradeStation we may need to convert this to a datetime object. This can be achieved using the following syntax:

// Initializes an instance of the DateTime class named DTime
DTime = DateTime.Create( );

// Find datetime for the right of the chart
// Convert from a legacy EasyLanguage Julian date to a datetime object
DTime.ELDateTimeEx = GetAppInfo( aiRightDispDateTime );

In order to use the datetime objects, you also need to add

using elsystem; // Required for the DateTime class

at the top of your program.