January 10, 2008 at 8:21 am
How do I display a 'datetime' field in a view as mm/dd/yyyy?
I'm trying to create a view with the dates in a more user-familiar format. The table I'm selecting from has a column DeedDate that is defined as a 'datetime' type. When I select that column, the field displays like 2008-01-10 09:55:00.000.
I tried this, but the display didn't change:
CONVERT (datetime,DeedDate,101)
Found this by google search, but it didn't change my display:
CONVERT (datetime,CONVERT(char(10),DeedDate,101))
Can someone please point me in the right direction? Thanks!
(I hope it's not too obvious that I'm pretty new at this stuff!)
January 10, 2008 at 8:26 am
select convert(varchar,getdate(),101)
January 10, 2008 at 8:27 am
Hello,
You can use this format. Run this statement in Query Analyzer
select convert(varchar(12), getdate(), 101)
Hope this helps.
Thanks
Lucky
January 10, 2008 at 8:29 am
WOW! What a great forum!! Answers that work in practically no time at all!
THANKS!!
January 10, 2008 at 8:30 am
Hi 🙂
Here is what you are looking for:
SELECT CONVERT (VARCHAR(13),@Vdt,103)
Please remember that it 99% of the time a better option to format dates on the Client side with the application than it is to with SQL.
Sql is a database langauge for reading writing etc.
Enjoy your day
Chris
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply