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 2005 Forums
 Transact-SQL (2005)
 Modify a DateTime field - change only date keep ti

Author  Topic 

rternier
Starting Member

44 Posts

Posted - 2007-11-13 : 11:11:12
I'm trying to figure this out - and I don't want to muck with the time at all.

I have the following data:
01/01/2007 12:00:08 AM
01/01/2007 12:00:18 AM
01/01/2007 12:00:28 AM
01/01/2007 12:00:38 AM
01/01/2007 12:00:48 AM
03/10/2007 11:59:39 PM
03/10/2007 11:59:49 PM
03/10/2007 11:59:59 PM
11/10/2007 2:16:09 PM
11/10/2007 2:16:19 PM
11/10/2007 2:16:30 PM
11/10/2007 2:16:40 PM

---
I want to change all of the dates to:
1/1/2007 but keep the time.

Is there a simple way of doing this?

----
Killer ASP.NET ninja coding monkeys do exist!
[url]http://weblogs.asp.net/rternier[/url]

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2007-11-13 : 11:32:01
dateadd(day, datediff(day, [YourDate], '1/1/2007'), [YourDate])

e4 d5 xd5 Nf6
Go to Top of Page
   

- Advertisement -