Muhammad Farhan
Muhammad Farhan

Reputation: 69

Need to show date in specific format sql server

I want to show current date in following format. 9/16/2019 5:35:55 PM

select getdate()

Upvotes: 0

Views: 76

Answers (2)

THE LIFE-TIME LEARNER
THE LIFE-TIME LEARNER

Reputation: 1522

declare @Date datetime =GETDATE()
select FORMAT(@Date,'MM/dd/yyyy hh:mm:s tt') AS CurrentDate

OR

Select Convert(char(10), getdate(),101) + Right(Convert(VarChar(20),getdate(),100),8)

You can use this Query...

Upvotes: 0

Fahmi
Fahmi

Reputation: 37473

You can use format()

SELECT FORMAT(getdate(), 'MM/dd/yyyy hh:mm:ss tt')

Upvotes: 1

Related Questions