How do you convert date to MM/DD HH/MM
example: 04-05 12:42
Since you are on SQL Server 2012, use FORMAT
:
SELECT FORMAT(GETDATE(), 'MM-dd HH:mm')
Try using the MONTH
, DAY
, HOUR
, MINUTE
functions in T-SQL and concatenate your results into a string form like:
CONCAT(STRING(HOUR(created_at)), ':', RIGHT(STRING(MINUTE(created_at)), 3)) AS hour_min
Where the created_at
is your timestamp column. Hope this helps!