#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    1
    Rep Power
    0

    SQL dateFormat Query


    Hi All,
    I have a sql query which returns me the start and end time of certain process, i just need another output being displayed beside, which gives me the difference of end time and start time, im able to do that by just subtracting end time minus start time, but the difference returns me null.

    i have pasted the query below,
    select PROCESS.START_TIME, PROCESS.END_TIME, (PROCESS.END_TIME-PROCESS.START_TIME)As Difference from DOCKETS_PUB.PROCESS

    this difference column returns me null, im doing this in a dbvisualizer.


    Any help on this would be appreciated.


    Thanks,
    Nandhini
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,118
    Rep Power
    4274
    what are the datatypes of those two columns? DATE? DATETIME? TIMESTAMP? INTEGER?

    how do you want the difference shown? in minutes? days? fractions of a year?

    and what's wrong with doing the calculation in your front-end app?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo