0

How do you convert date to MM/DD HH/MM

example: 04-05 12:42

eggwhites
  • 75
  • 3
  • 10
  • Looks like that question is about converting a string to a date, so not really a duplicate. – Jacob Apr 06 '17 at 01:00

2 Answers2

2

Since you are on SQL Server 2012, use FORMAT:

SELECT FORMAT(GETDATE(), 'MM-dd HH:mm')
Code Different
  • 82,550
  • 14
  • 135
  • 153
0

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!

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425