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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Georgian

Author  Topic 

sardinka
Posting Yak Master

142 Posts

Posted - 2005-09-14 : 14:37:43
How to convert the current date (getdate()) to a georgian date.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-09-14 : 14:38:21
What does the Georgian date format look like?

Tara
Go to Top of Page

sardinka
Posting Yak Master

142 Posts

Posted - 2005-09-14 : 15:05:04
It count of days 1-365.
Go to Top of Page

Vivaldi
Constraint Violating Yak Guru

298 Posts

Posted - 2005-09-14 : 15:10:45
quote:
Originally posted by sardinka

It count of days 1-365.


just guessing, but do you mean
(Days in Year) - (Day Number in year)
DateDiff in days from the beginning or end of the year should work.

my limited education hasn't familiarized my brain with such a format.

________________________________________________

Working man's privilege, beer is.
Harsh, Life is.


Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-09-14 : 15:10:54
I don't understand what you mean. Could you provide an example?

Tara
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-09-14 : 15:18:56
[code]
USE Northwind
GO

CREATE FUNCTION udf_Julian (
@d datetime
)
RETURNS varchar(7)
BEGIN
RETURN (SELECT CONVERT(char(4),YEAR(@d))+CONVERT(varchar(3),DATEPART(dy,@d)))
END

SELECT GetDate(), dbo.udf_Julian(GetDate())
GO

DROP FUNCTION udf_Julian
GO

[/code]


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

sardinka
Posting Yak Master

142 Posts

Posted - 2005-09-14 : 15:25:06
Thank you for your function that is exactly what I want.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-09-14 : 16:14:56
Are you sure that's right? What should January 1, 2005 return? (I am not 100% positive, but I would think 2005001 and not 20051 but I could be wrong).

declare @d datetime
set @d= '1/1/2005'

-- What Brett has:
SELECT CONVERT(char(4),YEAR(@d))+CONVERT(varchar(3),DATEPART(dy,@d))

-- But what about something like:
select Year(@d) * 1000 + DatePart(dy,@d)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-15 : 02:24:10
Or

RETURN (SELECT CONVERT(char(4),YEAR(@d))+RIGHT('000', CONVERT(varchar(3),DATEPART(dy,@d)), 3))

is you want a string rather than a numeric value

Kristen
Go to Top of Page
   

- Advertisement -