I am brand new to sql my company just kinda threw me head long into this and said do it. So any help is greatly appreciated. I am trying to get a date to come out in the format of mm/dd/yyyy hh:mm:ss AM/PM so for example a date of 09/26/2014 11:04:54 AM. I have tried using the code:
Select Convert(nvarchar,EntryDate,101)
From DB1
However that returns just 09/26/2014. I also tried
Select Convert(nvarchar,EntryDate,100)
From DB1
but this returns Sep 26 2014 11:04AM
Not sure where to go from here. Again thanks for the help. BTW I am using SQL Server 2012.
You can use FORMAT function in sql
SELECT FORMAT(@date,'MM/dd/yyyy hh:mm:s tt')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With