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
 General SQL Server Forums
 New to SQL Server Programming
 date format

Author  Topic 

sparrow37
Posting Yak Master

148 Posts

Posted - 2011-01-09 : 13:55:08
Hi all:

I am running this query

select convert(varchar(10),RunDate, 101) From AutomatedTestRun

and it returns:

01/09/2011

but I want

1/9/2011

How can I get this ?

Regards,
Asif Hameed

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2011-01-09 : 14:00:28
Select convert(varchar(10),
convert(varchar(2),month(Rundate))+'/'+
convert(varchar(2),day(Rundate))+'/'+
convert(varchar(4),year(Rundate)))
FROM AutomatedTestRun



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-10 : 11:01:34
this is a presentation issue and would be best dealt with at front end using formatting functions. Can you tell where eaxctly you're trying to display this?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -