July 24, 2006 at 5:49 am
Why the result of this is not 24-07-2006??
DECLARE @datestring datetime
SET @datestring = datepart(day, getdate()) - datepart(month, getdate()) - datepart(year, getdate())
SELECT @datestring
Thanks
Claudia
Cláudia Rego
www.footballbesttips.com
July 24, 2006 at 5:55 am
For the same reason these aren't...
select cast(24 - 7 - 2006 as datetime)
select cast(-1989 as datetime)
Maybe one of these is what you're after...
select replace(convert(varchar(30), getdate(), 103), '/', '-')
select dateadd(day, datediff(day, 0, getdate()), 0)
?
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
July 24, 2006 at 6:04 am
July 24, 2006 at 6:15 am
Ah, yes! I looked in BOL and missed 105
Thanks Karl
Cláudia - use that instead of 103 with replace (if that was what you needed).
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
July 24, 2006 at 7:47 am
Solved!!
Thanks a lot
Cláudia
Cláudia Rego
www.footballbesttips.com
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply