0

How can I retrieve only the TIME in the SmallDateTime datatype in SQL using SELECT Command?

Minima
  • 133
  • 1
  • 4
  • 13
  • You only want to select time from datetime column? Can you paste your query in there. – Emaad Ali Sep 19 '11 at 15:17
  • SELECT CONVERT(VARCHAR(8),GETDATE(),108) AS HourMinuteSecond, CONVERT(VARCHAR(8),GETDATE(),101) AS DateOnly GO The first query return time and the second one return only date. – Emaad Ali Sep 19 '11 at 15:18

1 Answers1

0

This will give the hour:

Select datename(hh, date_variable) from table_name

This will give the minute:

Select datename(mi, date_variable) from table_name
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Jibin Balachandran
  • 3,381
  • 1
  • 24
  • 38