By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,379 Members | 1,404 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,379 IT Pros & Developers. It's quick & easy.

datetime field in SQL Server 2005

P: 58
I m using SQL Server 2005 databse. There is a datetime field in table. I m fetching data from there but I want to display only date not time. How can I remove time?

I am fetching it by this line:

CAST(databasename.V_sdt.saledt AS varchar(30))

so how can I modify it to remove time?

thks
Mar 21 '08 #1
Share this Question
Share on Google+
3 Replies


ck9663
Expert 2.5K+
P: 2,878
I m using SQL Server 2005 databse. There is a datetime field in table. I m fetching data from there but I want to display only date not time. How can I remove time?

I am fetching it by this line:

CAST(databasename.V_sdt.saledt AS varchar(30))

so how can I modify it to remove time?

thks

use the style argument in CONVERT function.

-- CK
Mar 21 '08 #2

P: 58
thks for reply.
Can you please tell me by applying it to my code or by sample?
What is the difference between CAST and CONVERT?
thks
Mar 21 '08 #3

ck9663
Expert 2.5K+
P: 2,878
Check it here

-- CK
Mar 21 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.