?
Solved

Timediff/datediff in MS SQL server 2000

Posted on 2003-03-27
3
Medium Priority
?
1,939 Views
Last Modified: 2007-12-19
How can I calculate the time (hours and minutes) between startdate and enddate when datatype are datetime.

Ex hours and minutes spent on a project with startdate '2003-03-27 08:00:00' and enddate '2003-03-27 16:00:00'. Expected result is 8.

Thanks!
0
Comment
Question by:brekmar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 43

Expert Comment

by:Eugene Z
ID: 8217603
select DATEDIFF ( dd ,'2003-03-27 08:00:00'  , '2003-03-27 16:00:00' )
0
 
LVL 43

Accepted Solution

by:
Eugene Z earned 120 total points
ID: 8217609
previous was for days;
this one for hours
select DATEDIFF ( hh,'2003-03-27 08:00:00'  , '2003-03-27 16:00:00' )
0
 
LVL 43

Expert Comment

by:Eugene Z
ID: 8217618
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

777 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