With the eBackOffice financial apps, the dates are stored in SQL as julian dates. The application uses two sp's, appdtjul_sp and appjuldt_sp to convert between gregorian and julian dates.
The essence of the conversion that you can paste into a SQL stored proc or trigger is this:
[color red]/* Return a date (today) as a julian date: */
SELECT datediff(dd,"1/1/80",getdate())+722815
/* Convert Julian to gregorian: */
SELECT dateadd(dd,@juldate-722815,"1/1/80")[/color]
The general formula to use in other environments is:
[color green]((y - 1) * 365) + (97y - 99) / 400 + days this year
NOTE: Use integer calculations removing the remainders from the result. This formula also works for leap year.[/color]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.