tags:

views:

1550

answers:

2

Hi,

I looked at SQL Server dateformat codes but I couldn't find dd.mm.yyyy hh:mm format in the list. German Date Format(Code is 4) works for me but it doesn't contain hh:mm. Does someone know this format's code?

+2  A: 

Assuming your column is named [datefield]

CONVERT(varchar,[datefield],104)
     + ' '
     + SUBSTRING(CONVERT(varchar,[datefield],108),1,5)
tvanfosson
A: 

select CONVERT(varchar,getdate(),101) + ' ' + SUBSTRING(CONVERT(varchar,getdate(),108),1,5) + ' ' + SUBSTRING(CONVERT(varchar,getdate(),109),25,2)

*you may change the getdate() to the datefield you are trying to convert.

Herz Garlan
Herz weclome to Stackoverflow. The "PM" is redundant since the hour can be greater than 12.
Anthony Faull