Solved

SQL Format Time

Posted on 2011-03-23
3
561 Views
Last Modified: 2012-05-11

I have a datetime field in SQL that I need to convert to

HH:MM AM/PM

Concatenation is fine.

How?
0
Comment
Question by:cheryl9063
  • 2
3 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35202101
you could check out this:
select right( convert(varchar(30), yourfield, 0), 10)
0
 
LVL 1

Author Comment

by:cheryl9063
ID: 35202130
When I put getdate() in place of yourfield.. I get the below..


11  4:15PM
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 35202236
sorry:

select right( convert(varchar(30), yourfield, 0), 7)
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Query group by data in SQL Server - cursor? 3 50
query optimization 6 15
Need return values from a stored procedure 8 23
How can I get the entire database script? 7 15
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question