time difference in minutes

Posted on 2009-02-19
Last Modified: 2013-12-07

How to get with sql statements time difference in minutes between two dates? For example:
19.02.2009 6:54:32       and       18.02.2009 14:45:00

Question by:rtratar
    LVL 40

    Expert Comment


    declare @date1 datetime,@date2 datetime
    set @date1 = '02.18.2009 14:45:00'
    set @date2 = '02.19.2009 6:54:32'
    select datediff(mi,@date1,@date2)

    Open in new window

    LVL 40

    Accepted Solution

    In Oracle, try like this

    select (date2-date1)*24*60 

    Open in new window


    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
    Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
    This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

    746 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

    17 Experts available now in Live!

    Get 1:1 Help Now