# Function: JulianToDate

### Description

Converts a Julian date string to a date.

### Syntax

JulianToDate(string)

### Arguments

String is a Julian date string, for example 02105. The Julian date string must consist of only digits, and may have a length of 3, 4, 5, or 7 digits. In each case, the last 3 digits specify the day of the year, with 001=January 1, 002=January 2, 031=January 31, 032=February 1, etc.

### Return value

The return value is a date.

If the Julian date string has 7 digits, then the first 4 digits unambiguously specify the year. If the Julian date string has 5 digits, the first 2 digits are taken as a 2-digit year that is then resolved to a complete year value using the normal pivot year mechanism. If the Julian date string has only 4 digits, then the first digit is taken as the least significant digit of a year. In order to resolve this to a complete year value, JulianToDate assumes that it refers to some year within the last 10 years. For example: "2105" would be interpreted as 4/15/2002 (the 105th day of 2002"), whereas "3105" would be interpreted as 4/15/1993 (the 105th day of 1993). If users need to override this behavior, they are encouraged to prefix their data with the desired digits. For example, if they want "3105" to be interpreted as 4/15/2003, they could prefix their 4-digit Julian dates with the digits "200". If the Julian date string has only 3 digits, JulianToDate assumes that it refers to a date within the current year. Thus, "105" is interpreted as 4/15/2002. Again, users can always prefix their data with a suitable 4-digit year if necessary.

The function returns NULL if the given string cannot be interpreted as a Julian date.

### Calculated field example

If a field named JulianDate contains the value 2105, the following expression will return 4/15/2002: JulianToDate(JulianDate)

© 2024 Altair Engineering Inc. All Rights Reserved.