-
Julian Date Conversion Functions
Does anyone have Julian date conversion functions? To, or From?
ie. I get 99002 and want to convert to "1999/01/02"
or vise-versa.
Thanks in advance,
Dano
-
Julian Date Conversion Functions (reply)
/* Convert to Julian "01/03/1999" to "1999003" */
Declare @input_date datetime
Select @input_date = "01/03/1999"
Select datepart(year , @input_date ) * 1000 + datepart ( dy , @input_date )
/* Convert From Julian "1999003" to "01/03/1999" */
Declare @julian_date int
Select @julian_date = 1999003
Select dateadd ( day , (@julian_date % 1000 - 1 ), convert( datetime , convert(char(4) , (@julian_date / 1000)) + '/01/01' ))
------------
Dano at 1/3/00 5:40:14 PM
Does anyone have Julian date conversion functions? To, or From?
ie. I get 99002 and want to convert to "1999/01/02"
or vise-versa.
Thanks in advance,
Dano
-
Julian Date Conversion Functions (reply)
Thanks, you saved me some time.
Dano
------------
Deepak Nayak at 1/5/00 11:37:08 AM
/* Convert to Julian "01/03/1999" to "1999003" */
Declare @input_date datetime
Select @input_date = "01/03/1999"
Select datepart(year , @input_date ) * 1000 + datepart ( dy , @input_date )
/* Convert From Julian "1999003" to "01/03/1999" */
Declare @julian_date int
Select @julian_date = 1999003
Select dateadd ( day , (@julian_date % 1000 - 1 ), convert( datetime , convert(char(4) , (@julian_date / 1000)) + '/01/01' ))
------------
Dano at 1/3/00 5:40:14 PM
Does anyone have Julian date conversion functions? To, or From?
ie. I get 99002 and want to convert to "1999/01/02"
or vise-versa.
Thanks in advance,
Dano
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|