April 15, 2009 at 7:12 am
I have field date :3/31/2009 12:00:00 AM
I need to have result as:
Date Time
3/31/2009 12:00:00 AM
How can I do it?
Thank you
June 25, 2009 at 10:56 pm
Not quite what you may have been looking for, but it does separate the date and time.
declare @TestDate datetime;
set @TestDate = getdate();
select
@TestDate as TestDate, -- Original Source Date
convert(char(10), @TestDate, 101) as Date, -- Date Portion
convert(Char(12), @TestDate, 108) as [Time] -- Time Portion
June 26, 2009 at 5:56 am
Thank you:-)
June 26, 2009 at 12:49 pm
Krasavita (6/26/2009)
Thank you:-)
Heh... wait a minute, now.... splitting the date and time is normally a really, really bad thing to do. Why do you need to do this?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply