extracting the ISO date from a datetime object
- From: "M. S." <michele.simionato@xxxxxxxxx>
- Date: Wed, 19 Aug 2009 00:45:01 -0700 (PDT)
I spent one hour looking for a way to extract a string in the format
yyyy-mm-dd from a date time object.
At the end I give up and I defined a custom function:
CREATE FUNCTION isodate10(@date datetime)
RETURNS CHAR(10) AS BEGIN
RETURN cast(year(@date) as char(4)) + '-' +
cast(month(@date) as char(2)) + '-' +
cast(day(@date) as char(2))
END
What's the name of this function in SQL Server 2005? Is there a
simpler way of doing this?
Thanks,
M.S.
.
- Follow-Ups:
- Re: extracting the ISO date from a datetime object
- From: Tibor Karaszi
- Re: extracting the ISO date from a datetime object
- From: Michele Simionato
- Re: extracting the ISO date from a datetime object
- Prev by Date: Re: Configuring a Report Server for E-Mail Delivery (SQL 2000)
- Next by Date: Re: extracting the ISO date from a datetime object
- Previous by thread: Restore multiple transact logs
- Next by thread: Re: extracting the ISO date from a datetime object
- Index(es):
Relevant Pages
|