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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Julian Date

Status
Not open for further replies.

EPNICO

MIS
Joined
Jun 14, 2001
Messages
45
Location
US
Hello:

I need to find out if Sybase or MSSQL7.0 has some way to convert a date to a julian date?

Thanks

 
There are many definitions of "Julian Date." The following links should help.

Sybase function:

Here are some T-SQL queries that return various forms of the Julian date.

-- Julian in format yyddd

Declare @jd char(5)
Select @jd=
right(Convert(char(4), year(getdate())),2) +
right('00'+convert(varchar(3),datepart(dd,getdate())),3)
Print @jd

-- Julian date in format tttt.ddd

Declare @jd char(7)
Select @jd=
Convert(char(4), year(getdate())) + '.' +
right('00'+convert(varchar(3),datepart(dd,getdate())),3)
Print @jd

-- Julian date based on the number of days since noon, Universal Time on January 1, 4713 BCE. Jan 1, 1900 was Julian date 693596.

Select @jd=DATEDIFF(D,'1/1/1900',getdate())+693596
Print @jd Terry L. Broadbent
Programming and Computing Resources
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top