Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert eBO julian dates

eBackOffice Misc Utilities

How to convert eBO julian dates

by  Flloyd  Posted    (Edited  )
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]

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top