0

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

example: 04-05 12:42

eggwhites
  • 75
  • 3
  • 11
  • 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
  • 90,614
  • 16
  • 144
  • 163
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
  • 732,580
  • 175
  • 1,330
  • 1,459