I have a column of data in SQL that is currently in the datetime format. It can be changed if needed. I need to show just the time of day, to the 10th of a second, with either AM or PM attached also. I do not want the date to be shown in this instance.
So instead of ‘1900-01-01 11:45:59.800′ as an example, i need ’11:45:59.8 AM’.
Also, this is not a current “getdate” time. It is from a field of data i have called ‘Time’
I see all sorts of convert formats on the web, but none will pull this up for me.
Thank you!!!!
As in my comment, I’d advise you to not do this.
SQL Server is a place for data, and converting the data for display purposes is often a blurring of the lines that can come back to haunt you. (One example; what if you need that time as a Time somewhere else in the future. Are you going to convert it back from a string again?)
If it is Necessary, then you have to do some of the formatting yourself.
Or, more messy…
Did I say? You’re better doing it on the client side 😉