0

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

select getdate()

  • 1
    Possible duplicate of [How to format datetime in SQL SERVER](https://stackoverflow.com/questions/23837672/how-to-format-datetime-in-sql-server) – Igor Sep 16 '19 at 12:47
  • 2
    SQL Server's date and time data type don't have a format. if you need it in a format, then that's for your presentation layer. – Thom A Sep 16 '19 at 12:48

2 Answers2

1

You can use format()

SELECT FORMAT(getdate(), 'MM/dd/yyyy hh:mm:ss tt')
Fahmi
  • 37,315
  • 5
  • 22
  • 31
0
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...

THE LIFE-TIME LEARNER
  • 1,476
  • 1
  • 8
  • 18