Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hi all,i have a time stamp column whose format is (yyyy-mm-dd)2013-10-07 05:51:38.410I would want to extract only date(dd) part from the above.Kindly provide me the query friends.Thanks,Vijay
gbritton
Master Smack Fu Yak Hacker
2780 Posts
Posted - 2014-08-27 : 08:39:48
If the column is type datetime:
select datepart(day, timestampcolumn)
if the column is type varchar:
select datepart(day, cast(timestampcolumn as datetime))
James K
Master Smack Fu Yak Hacker
3873 Posts
Posted - 2014-08-27 : 08:40:43
[code]DATEPART(dd,YourStampColumn)[/code]
vijay1234
Starting Member
48 Posts
Posted - 2014-08-28 : 01:27:29
Thanks Friends.select CONVERT(VARCHAR(10), DAY(Getdate()), 112) is what i've tried.:)