Here is a little bit of sql to help convert Julian dates to Gregorian dates. It seems as though some ERP systems use Julian dates to store their date information vs datetime. It works on a formula that determines the number of days since 1/1/1900.
Declare @JulianDate as int,
@GregorianDate as smalldatetime
when@JulianDate > 0
thendateadd(dd,(@JulianDate%1000)-1,cast(dateadd(yy,(@JulianDate/1000),'01/01/1900') as smalldatetime))
The reason for making sure the @JulianDate variable is>0is to keep the result as a smalldatetime. If you run just the formula and @JulianDate = 0 the result is '12/31/1899', which is a datetime. I find wasting 4 bytes (smalldatetime:4 bytes, datetime:8 bytes) for this condition is senseless since julian dates don't store time, just the day.