Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 need to get the date format in dd-MM-yyyy
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

aoriju
Posting Yak Master

India
156 Posts

Posted - 08/05/2013 :  03:57:22  Show Profile  Reply with Quote

DECLARE @t DATETIME

SET @t ='2013-05-17';

i need to get the date format in
dd-MM-yyyy

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 08/05/2013 :  04:14:55  Show Profile  Reply with Quote
this is a presentation issue and you should be trying to do this at front end
If no other way, use query like this


DECLARE @t DATETIME

SET @t ='2013-05-17'

SELECT CONVERT(varchar(11),@t,105)



if SQL 2012 use


SELECT FORMAT(@t, 'dd-MM-yyyy')


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22864 Posts

Posted - 08/18/2013 :  12:40:37  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
If you can't avoid formatting in SQL, use CONVERT function because FORMAT is very slow http://beyondrelational.com/modules/2/blogs/70/Posts/17608/different-ways-to-remove-time-part-from-datetime-values-faster-methods.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000