Amit Patil
Amit Patil

Reputation: 1993

Datetime format help

I want only Hr and Min in time format so i did

select convert(varchar(20),GETDATE(),108) ===>> output is "12:57:54"

but i want only "12:57" this much so how i will do that in sql server

Upvotes: 1

Views: 93

Answers (2)

Kashif
Kashif

Reputation: 14430

select convert(varchar(5),GETDATE(),108)

Upvotes: 1

codingbadger
codingbadger

Reputation: 43974

Select cast(DatePart(hour, getdate()) as varchar(2)) + ':' + cast(DatePart(minute, getdate())as varchar(2))

Upvotes: 0

Related Questions