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
Loading
brit arunPosted May 18, 2012, 6:44 AM
Use this
Select convert(varchar,getdate(),101)
Kunal VaishyaPosted May 18, 2012, 6:15 AM
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)
Kunal VaishyaPosted May 18, 2012, 6:10 AM
Select Convert(Varchar,Getdate(),103)
Santhosh K SPosted May 18, 2012, 3:46 AM
brit arunPosted May 18, 2012, 3:40 AM
Use the below code
select convert(smalldatetime,'14/05/2012 20:20:00',101)
it will return 15/04/2012 20:20:00