SQL Server Forums
Profile | Register | 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
 New Topic  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
52309 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
22744 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  
 New 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.03 seconds. Powered By: Snitz Forums 2000