i am using right now
convert(char(29),datetime,109)it is of format Aug 13 2013 04:10:02:000 PM
but i want in dd/MM/yyyy 04:10:02 PM format i.e:13/08/2013 04:10:02PM
Cast convert problem i want the format to be in dd/MM/yyyy
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Ravi ShekharRank #673 · 3.6K reputationPosted Aug 13, 2013, 9:13 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 13, 2013, 8:53 PM EDT
If you want to do in SQL then here it is
select convert(varchar(10),GETDATE(),103)+' '+convert(varchar(10),GETDATE(),108)+' '+right(convert(varchar,GETDATE(),100),2)
in you want to do in C#
string dt=String.Format("{0:dd/MM/yyyy hh:mm:ss tt}", Convert.ToDateTime(dateTimeValue));
Regards,
Iftikar
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 13, 2013, 8:55 PM EDT
you can try this
SELECT convert(nvarchar(20),CONVERT(date, 'Aug 13 2013 04:10:02:000 PM'),105)+' '+ convert(nvarchar(20),CONVERT(time, 'Aug 13 2013 04:10:02:000 PM'),100)