• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 311
  • Last Modified:

Oracle 11g - Query To get the time between to date/time

Hi all

In my query, i'm pulling 2 dates from 2 columns like bellow:
TO_CHAR(LS.EARLY_ARRV, 'YYYY-MM-DD HH24:MI') AS ARRIVAL_PLANNED, 
TO_CHAR(LS.DEPART, 'YYYY-MM-DD HH24:MI') AS DEPARTURE_PLANNED,

Open in new window


What i would like to do is to count the elapse time between them. how can i include this in the query?
Something like:
(TO_CHAR(LS.DEPART, 'YYYY-MM-DD HH24:MI') - TO_CHAR(LS.EARLY_ARRV, 'YYYY-MM-DD HH24:MI')) 

Open in new window


I would need to get the result in 0.00 format.

Thanks for your help.
0
Wilder1626
Asked:
Wilder1626
  • 2
1 Solution
 
sdstuberCommented:
what does 0.00  represent?  days? hours? minutes?
0
 
sdstuberCommented:
round(ls.depart - ls.early_arrv,2)    - this will return result in days

round((ls.depart - ls.early_arrv) * 24,2)    - this will return result in hours

round((ls.depart - ls.early_arrv) * 1440,2)    - this will return result in minutes

round((ls.depart - ls.early_arrv) * 86400,2)    - this will return result in seconds
0
 
Wilder1626Author Commented:
Thank you so much, just what i needed.

round((ls.depart - ls.early_arrv) * 24,2)    - this will return result in hours
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now