tags:

views:

29

answers:

2

What is the function DATE_FORMAT in SQL Server

I want to change my now date to d-m-Y h:i

How to do

A: 

The MySQL documentation for date_format is pretty good.

select date_format(NOW(), '%d-%m-%Y %H:%i');
ar
+4  A: 

I'm afraid that, in SQL Server, giving format to a date is not as simple as it should. You end up doing stuff like:

CONVERT(VARCHAR, CURRENT_TIMESTAMP, 103) + ' ' + CONVERT(VARCHAR(8), CURRENT_TIMESTAMP, 114)

You can find the reference at http://msdn.microsoft.com/es-es/library/ms187928.aspx

Álvaro G. Vicario