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
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ravi ShekharPosted Aug 14, 2013, 1:13 AM
Sanjeeb LenkaPosted Aug 14, 2013, 12:55 AM
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)
Iftikar HussainPosted Aug 14, 2013, 12:53 AM
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