Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date Conversion

Author  Topic 

pgmr1998
Yak Posting Veteran

66 Posts

Posted - 2012-05-05 : 12:21:23
Have a field in a table that contains JDEdwards Julian date data that is in the format CYYDDD. How can I convert this column of data into something like mm/dd/yyyy?
Are there any date conversion routines?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-05 : 12:35:26
see this example

DECLARE @JulDate int
SET @JulDate=107263
SELECT CONVERT(varchar(11),DATEADD(dd,(@JulDate%1000)-1,DATEADD(yy,(@JulDate/1000),0)),101) AS dateval


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

pgmr1998
Yak Posting Veteran

66 Posts

Posted - 2012-05-05 : 13:15:36
I get an error that says
Token @JULDATE was not valid
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-05 : 13:42:21
quote:
Originally posted by pgmr1998

I get an error that says
Token @JULDATE was not valid


show the full query if its different from what i posted
posted query is tested and is working for me





------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-05 : 13:43:15
Token @JULDATE was not valid
Are you using MS SQL Server. Doesnt look like a t-sql error message from above
Are you using different editor?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

pgmr1998
Yak Posting Veteran

66 Posts

Posted - 2012-05-05 : 13:47:44
Im on an IBM AS400 iSeries
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-05 : 14:10:48
quote:
Originally posted by pgmr1998

Im on an IBM AS400 iSeries


then you're in wrong forum
This is MS SQL Server forum
Please post in reelevant forum for getting specific syntax help

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -