Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

datetime cast hours minutes

Posted on 2010-11-21
2
Medium Priority
?
750 Views
Last Modified: 2012-05-10
I would like to return only minutes and hours from datetime.
For example GetDate() should return 13:40
How is best to do that?
0
Comment
Question by:johnkainn
2 Comments
 
LVL 8

Accepted Solution

by:
Den_HBR earned 500 total points
ID: 34183126
SELECT CONVERT(VARCHAR(5), GETDATE(), 108)
0
 
LVL 30

Expert Comment

by:Reza Rad
ID: 34183127
select Convert(char(2),datepart(Hour,getdate()))+':'+convert(char(2),datepart(MINUTE,getdate()))
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

926 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