Click here to Skip to main content
16,021,209 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to convert dd/mm/yyyy varchar to mm/dd/yyyy varchar in sql server 2005?
Posted

Try this for any date in dd/mm/yyyy
select convert(varchar, convert(datetime, '13/06/2014', 103), 101)

However, the correct way is to use correct data type from the beginning, e.g. date should be date not varchar.
 
Share this answer
 
v2
Why do you do that to yourself? :)

Handling datetimes as nvarchar in your database does not present any advantage and has huge drawbacks when it comes to sorting or defining time ranges.

Please use the proper data format. The only moment where a string is involved regarding a datetime is on the presentation layer, when the data is presented to the user. Any former use of a datetime as a string is purely nonsense.
 
Share this answer
 
Hi,

Hope this will help you.

SQL
SELECT CONVERT(VARCHAR,CONVERT(VARCHAR,GETDATE(),103),101)
 
Share this answer
 
Try for this
SQL
SELECT CONVERT(VARCHAR,GETDATE(),103)
 
Share this answer
 
v2
try this.. :)

SQL
select convert(varchar,getdate(),103) --dd/mm/yyyy
select convert(varchar,getdate(),101) --mm/dd/yyyy


for info

Convert Datetime to string in many formats[^]
 
Share this answer
 
v2
Best site to be refer for Date time format in sql

http://www.sql-server-helper.com/tips/date-formats.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900