sql-serversql-server-2008

Date format in dd/MM/yyyy hh:mm:ss


I need to convert datetime from 2012-07-29 10:53:33.010 to 29/07/2012 10:53:33.

I tried using

select CONVERT(varchar(20), GETDATE(), 131)

but its showing date according to Hijri calendar

11/09/1433 10:53:33:

Please help?


Solution

  • This can be done as follows :

    select CONVERT(VARCHAR(10), GETDATE(), 103) + ' '  + convert(VARCHAR(8), GETDATE(), 14)
    

    Hope it helps