Solved

datetime cast hours minutes

Posted on 2010-11-21
2
695 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 125 total points
Comment Utility
SELECT CONVERT(VARCHAR(5), GETDATE(), 108)
0
 
LVL 30

Expert Comment

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

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Search for strings with a white space in sql 9 27
Save sql query result in sql server 15 22
IN with @variable 5 15
Sql query 34 16
     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now