select convert(smalldatetime,'14/05/2012 20:20:00',103)
output is 2012-05-14 20:20:00
But
i need date in terms of 15/04/2012 20:20:00,Because i need to compare 15/04/2012 20:20:00 with column of type smalldatetime column in a table please suggest........
thanks in advance
Reply fast as possible?
5 Answers
Know the answer? Post it. Somebody with the same question will find it here.

brit arun5 reputationPosted May 18, 2012, 2:44 AM EDT
Use this
Select convert(varchar,getdate(),101)
brit arun5 reputationPosted May 17, 2012, 11:40 PM EDT
Use the below code
select convert(smalldatetime,'14/05/2012 20:20:00',101)
it will return 15/04/2012 20:20:00
Santhosh K S34 reputationPosted May 17, 2012, 11:46 PM EDT
Kunal VaishyaRank #990 · 2K reputationPosted May 18, 2012, 2:10 AM EDT
Select Convert(Varchar,Getdate(),103)
Kunal VaishyaRank #990 · 2K reputationPosted May 18, 2012, 2:15 AM EDT
as per requirment
Select Convert(Varchar,Getdate(),101) - MM/dd/yyyy
Select Convert(Varchar,Getdate(),103) - dd/MM/yyyy
For MM/dd/yyyy
Select Convert(Varchar,Getdate(),1)
dd/MM/yyyy
Select Convert(Varchar,Getdate(),3)
hh:mm:ss
Select Convert(Varchar,Getdate(),2)