How can i get only the time in am/pm format from datetime field

How can i get only the time in am/pm format from datetime field

Post by Kalen Delane » Sat, 24 Jun 2000 04:00:00



select substring(convert(char(20), datetime_column), 13,19)

to verify: select substring(convert(char(20), getdate() ), 13,19)

HTH

--
Kalen Delaney
MCSE, SQL Server MCT, MVP
www.InsideSQLServer.com
Feed Someone for Free Today:
     www.TheHungerSite.com

 
 
 

1. Getting AM/PM Time formatting in a field with two Times

 I am having trouble getting the AM/PM to attach to a  set of times. It is OK
if my
field has just one time (  08:00 ) but not if it contains two ( 08:00 - 09:30)
for instance.The TO_CHAR(time,'HH:MI P.M.') gives me an error if format. If I
try to separate the two times, where do I set the formatting for TO_CHAR in a
combined function? I need to attach AM or PM to either times in the field.
Thanks.
   Zekmoe

2. Ardent customer mailing list STOP

3. Save time in hh:mm:ss AM/PM format

4. Detecting presence of SQL 7/200 service

5. Joins with Temporary Data

6. error ORA-01855: AM/A.M. or PM/P.M. required

7. 24 hour time switches to incorrect am/pm time

8. check DateTime range btw 8:00 AM and 8:00 PM

9. Convert mm/dd/yyyy hh:mm:ss AM/PM to mm/dd/yyyy format

10. h:nn AM/PM Format in SQL

11. How to return time with AM/PM?